仅在导出的签名 APK 上出现 IllegalAccessError

发布于 2024-10-25 05:24:01 字数 1937 浏览 1 评论 0原文

我这里真的遇到麻烦了。我有一个使用 Google Analytics for Android 库的应用程序,当我从 eclipse 在我的设备上运行该应用程序时,它可以正常工作。

当项目准备好发布时,我将应用程序的更新上传到 Android Market。幸运的是,我决定检查该应用程序是否正常工作,因此在卸载我自己的应用程序版本后,我从 Android Market 下载了刚刚上传的新版本。打开应用程序时,应用程序崩溃并出现以下错误:

java.lang.IllegalAccessError: tried to access method com.google.android.apps.analytics.g$a.<init>:(Lcom/google/android/apps/analytics/a$a;Lcom/google/android/apps/analytics/g;Ljava/lang/String;Ljava/lang/String;)V from class com.google.android.apps.analytics.c
    at com.google.android.apps.analytics.c.<init>(Unknown Source)
    at com.google.android.apps.analytics.c.<init>(Unknown Source)
    at com.google.android.apps.analytics.c.<init>(Unknown Source)
    at com.google.android.apps.analytics.b.a(Unknown Source)
    at com.google.android.apps.analytics.f.a(Unknown Source)
    at com.me.myapp.onCreate(Unknown Source)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)

我不知道为什么会发生这种情况。我只能说,我的项目 /bin/ 目录中的 APK 比所谓的签名和导出的 APK 大 0.1 Mb 左右。我尝试通过 ADB 手动将签名并导出的 APK 安装到我的设备上,但出现与上述相同的错误。

任何帮助将不胜感激。

I'm having real trouble here. I have an app which uses the Google Analytics for Android lib and works fine when I run the app on my device from eclipse.

When the project was ready for release, I uploaded the update for my app onto the Android Market. Luckily, I decided to check that the app worked, so after uninstalling my own version of the app, I downloaded from the Android Market the new version I had just uploaded. On opening the app, the app crashes with the following error:

java.lang.IllegalAccessError: tried to access method com.google.android.apps.analytics.g$a.<init>:(Lcom/google/android/apps/analytics/a$a;Lcom/google/android/apps/analytics/g;Ljava/lang/String;Ljava/lang/String;)V from class com.google.android.apps.analytics.c
    at com.google.android.apps.analytics.c.<init>(Unknown Source)
    at com.google.android.apps.analytics.c.<init>(Unknown Source)
    at com.google.android.apps.analytics.c.<init>(Unknown Source)
    at com.google.android.apps.analytics.b.a(Unknown Source)
    at com.google.android.apps.analytics.f.a(Unknown Source)
    at com.me.myapp.onCreate(Unknown Source)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)

I have no idea why this is happening. All I can say is that the APK in my project's /bin/ directory is about 0.1 Mb bigger than the supposedly signed and exported APK. I have tried installing the signed and exported APK onto my device via ADB manually but I get the same error as above.

Any help would be hugely appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最笨的告白 2024-11-01 05:24:04

虽然这是一个老问题,但它在某些时候可能会对某人有所帮助。我在这方面也遇到了很多麻烦,并且导出包的解决方案相当随机。

我的一般解决方案是禁用自动构建,清理它,然后手动构建库项目。

例如

  • Project菜单下
  • 取消选中Buildautomatic
  • 然后Project> 清理...
  • 在此窗口中,取消选中立即开始构建
  • 选择清理所有项目,然后单击确定
  • 如果有)您的项目中没有其他包含的项目,只有一个项目,将您的项目导出为签名的 APK。

如果您包含任何库项目(Sherlock ActionBar、HoloEverywhere 等),

  • 请分别选择每个项目并执行 Project > 构建项目(不是构建全部)。
    • 这将仅构建这一个库
    • 对您已包含的所有库项目执行此操作。
  • 单击“立即”,将您的项目导出为签名的 APK。

这通常对我有用,并阻止了许多无法解释的出口问题。

While this is an old question, it may help someone at some point. I've had lots of trouble with this as well and the exporting packages solutions are fairly random.

My general solution is to disable the auto build, clean it and then manually build the library projects.

For example

  • Under the Project menu
  • Uncheck Build automatically
  • Then Project > Clean...
  • On this window, uncheck Start build immediately
  • Choose Clean all projects and click OK
  • If you have no other included projects in your and is just the one, export your project as a signed APK.

If you have any library projects included (Sherlock ActionBar, HoloEverywhere, etc)

  • Select each project individually and do Project > Build project (NOT Build All).
    • This will build ONLY this one library
    • Do this for any library projects you have included.
  • Click Now, export your project as a signed APK.

That generally works for me and stops a lot of the unexplained export issues.

隐诗 2024-11-01 05:24:02

我遇到了看似相同的错误,但通过将其添加到我的 proguard.cfg 中来修复它:

-keep class com.google.android.apps.analytics.PipelinedRequester$Callbacks

I had what appeared to be the same error, but fixed it by adding this to my proguard.cfg:

-keep class com.google.android.apps.analytics.PipelinedRequester$Callbacks
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文