Lollipop 5.0 application for checking the correct selection of applications on the emulator (AVD)

When running the sample license check application provided by google in sdk / extras / google / play_licensing, it will crash on an emulator (AVD) running Lollipop (5.0) (I don't have a phone running 5.0). It works great on a phone running Kitkat.

In 4.4 Kitkat it gives a warning

Implicit intents with startService are not safe: Intent { act=com.android.vending.licensing.ILicensingService } 

android.content.ContextWrapper.bindService:538 com.google.android.vending.licensing.LicenseChecker.checkAccess:150 LicActivity.doCheck:126 

      

I'm not sure if 5.0 they moved it from warning to full error.

I don't know how to convert the call to the implicit intent to the explicit one. It is called in the LicenseChecker class

   boolean bindResult = mContext
                            .bindService(
                                    new Intent(
                                            new String(
                                               Base64.decode("HEX_TEXT"))),
                                    this, // ServiceConnection.
                                    Context.BIND_AUTO_CREATE);

      

BASE 64 decode to com.android.vending.licensing.ILicensingService

I get the error Sorry, the license check has stopped. in the dialog box.

Shows this message in logcat

java.lang.RuntimeException: Unable to instantiate application com.android.vending.VendingApplication: java.lang.ClassNotFoundException:

 Didn't find class "com.android.vending.VendingApplication" on path: DexPathList[[zip file "/system/app/LicenseChecker/LicenseChecker.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

      

Reported a while ago but still no solution

http://code.google.com/p/android/issues/detail?id=61680

+3


source to share


2 answers


Adding

intent.setPackage("com.android.vending");

      



to yours Intent

ensures that this is the explicit intent as required by Android 5.0.

+9


source


try it



Intent serviceIntent = new Intent(
     new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")));
     serviceIntent.setPackage("com.android.vending");

     boolean bindResult = mContext
             .bindService(
               serviceIntent,
               this, // ServiceConnection.
               Context.BIND_AUTO_CREATE);

      

+1


source







All Articles