gpt4 book ai didi

java - Android 应用许可致命异常 : Service Intent must be explicit

转载 作者:太空狗 更新时间:2023-10-29 13:52:17 24 4
gpt4 key购买 nike

我正在将旧版 Android 应用程序从 Eclipse 迁移到 Android Studio。

大约 3-4 年前,在旧版 Android 上一切正常。

现在,当我在 Android 7.0 上运行该应用程序时,android.vending.licensing 会产生以下(服务 Intent 必须明确)致命异常:

java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=110, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } (has extras) }} to activity {HexagoniaGalaxyS7.hexagoniagalaxys7.apk/hexagoniagalaxys7.apk.HexagoniaActivity}: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } }

Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } }

这是我的代码:

 String deviceId = tManager.getDeviceId();
licenseCheckerCallback = new HexagoniaLicenseCheckerCallback();
licenceChecker = new LicenseChecker(this, new ServerManagedPolicy(this, new AESObfuscator(JUMBLE, getPackageName(), deviceId)), BASE64_PUBLIC_KEY);

licenceChecker.checkAccess(licenseCheckerCallback); // **IT CRASHES ON THIS LINE**

我已经坚持了 2 天 - 非常感谢任何帮助。

最佳答案

Intent intent = new Intent(new Intent(new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))));
intent.setPackage("com.android.vending");
boolean bindResult = mContext
.bindService(
intent,
this, // ServiceConnection.
Context.BIND_AUTO_CREATE);

供您引用,发生此问题是因为必须明确定义 Intent ,这意味着您必须调用 setPackage(String) 并将有关服务或其他内容的信息传递给函数。通过这样做,您可以告诉 Android 您想要调用什么,由于 Android 安全限制,您必须这样做。顺便说一句,您必须将许可模块 build.gradle 文件中的 minSdkVersion 从 3 更改为 4,以允许使用 setPackage(String) 进行 Intent 。

关于java - Android 应用许可致命异常 : Service Intent must be explicit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44904890/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com