仅在导出的签名 APK 上出现 IllegalAccessError
我这里真的遇到麻烦了。我有一个使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然这是一个老问题,但它在某些时候可能会对某人有所帮助。我在这方面也遇到了很多麻烦,并且导出包的解决方案相当随机。
我的一般解决方案是禁用自动构建,清理它,然后手动构建库项目。
例如
如果您包含任何库项目(Sherlock ActionBar、HoloEverywhere 等),
这通常对我有用,并阻止了许多无法解释的出口问题。
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
If you have any library projects included (Sherlock ActionBar, HoloEverywhere, etc)
That generally works for me and stops a lot of the unexplained export issues.
我遇到了看似相同的错误,但通过将其添加到我的 proguard.cfg 中来修复它:
I had what appeared to be the same error, but fixed it by adding this to my proguard.cfg: