Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lollipop 5.0 Sample License Checker App crashes on Emulator (AVD)

When running the the sample license check app provided by Google in sdk/extras/google/play_licensing it crashes on the Emulator(AVD) running Lollipop (5.0) (I don't have a phone running 5.0). It works fine on Phone running Kitkat.

On 4.4 Kitkat it gives a warning the

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 am not sure 5.0 they have moved it from a warning to full blown error.

I don't know how to convert the implicit intent call to an explicit one. It's being called in the LicenceChecker class

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

BASE 64 decodes into com.android.vending.licensing.ILicensingService

I just receive an error message Unfortunately, licence checker has stopped. in a dialog box.

It is showing 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]]

It's been reported a while back but still no solution

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

like image 997
pt123 Avatar asked Nov 23 '25 01:11

pt123


1 Answers

Adding

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

to your Intent ensures that it is an explicit intent as required by Android 5.0.

like image 133
ianhanniballake Avatar answered Nov 26 '25 17:11

ianhanniballake



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!