尝试检查yn应用程序的许可证时收到以下错误:
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
发生在以下代码中:
Context AppContext=context;
String packageName=AppContext.getPackageName();
mLicenseCheckerCallback = new LicenseCheckerCallbackNew();
String deviceId = Secure.getString(AppContext.getContentResolver(),
Secure.ANDROID_ID);
LicenseChecker mChecker;
try{
if(bstrict){
mChecker = new LicenseChecker(context, new StrictPolicy(),BASE64_PUBLIC_KEY);
}else{
mChecker = new LicenseChecker(context, new ServerManagedPolicy(AppContext, new AESObfuscator(SALT, packageName, deviceId)),BASE64_PUBLIC_KEY);
}
mChecker.checkAccess(mLicenseCheckerCallback); <--------- Error
}catch(Exception e){
sendBackLicenseCheck("ApplicationError",0);
}
我所有的值都正确填写:packageName,SALT,BASE64_PUBLIC_KEY,deviceId
我对gradle的依赖
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support:design:27.0.1'
testCompile 'junit:junit:4.12'
compile files('libs/lvl.jar')
compile files('libs/google-play-services.jar')
compile 'com.facebook.android:facebook-android-sdk:4.29.0'
compile files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
}
这在过去起作用。我不知道,所以我在这里问。
有人可以帮忙吗?
最佳答案
如果启动Service
,则应如下所示。
Intent intent = new Intent(context,Service.class);
context.startService(intent);
或者,您可以使用
action
。Intent intent = new Intent("defined_action");
intent.setPackage("com.example.app");
context.startService(intent);
如果它的崩溃是来自第三方库。那么我建议您使用它的letest版本。
关于java - 有 Intent 的许可错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48971235/