IllegalAccessError only on Exported Signed APKs
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 ont开发者_Go百科o 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.
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
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.
精彩评论