在运行Google提供的位于sdk/extras/google/play_licensing目录下的示例许可证检查应用程序时,模拟器(AVD)中的Lollipop(5.0)版本崩溃了(我没有一部运行5.0的手机)。在运行Kitkat的手机上,它可以正常工作。
在4.4 Kitkat版本中,它会发出警告:
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
我不确定5.0版本是否已将其从警告变为完全错误。
我不知道如何将隐式意图调用转换为显式意图。它在LicenceChecker类中被调用。
boolean bindResult = mContext
.bindService(
new Intent(
new String(
Base64.decode("HEX_TEXT"))),
this, // ServiceConnection.
Context.BIND_AUTO_CREATE);
BASE64 解码成 com.android.vending.licensing.ILicensingService。
我刚刚在对话框中收到一个错误消息很遗憾,许可证检查程序已停止。。
它在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]]
这个问题在一段时间前已经被报道,但仍然没有解决方案。