Question

I use Google Play Game Services lib in my project (as well as BaseGameUtils). My app works when I launch it from Eclipse, but today I exported it as apk, launched and got an AbstractMethodError. I tried to make apk both with eclipse and ant but had the same result. Eclipse-make and ant-make apk worked before I've added (or started using) Google Play Game Services in my project (it's not a new one). How can I resolve this strange issue? It looks like gms code is incompatible with my binaries?

Stack trace:

java.lang.AbstractMethodError: abstract method not implemented
    at com.google.android.gms.internal.be.onViewAttachedToWindow(Unknown Source)
    at android.view.View.dispatchAttachedToWindow(View.java:11948)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2415)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2422)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2422)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1209)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1006)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4404)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
    at android.view.Choreographer.doCallbacks(Choreographer.java:562)
    at android.view.Choreographer.doFrame(Choreographer.java:532)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5041)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
    at dalvik.system.NativeStart.main(Native Method)
Was it helpful?

Solution

This type of error is usually due to using Proguard with a targetSDK that's too old. Try setting your application's target SDK to >= 17 and see if this fixes the problem.

In AndroidManifest.xml:

<manifest ...>

    <uses-sdk android:minSdkVersion="8" 
              android:targetSdkVersion="17"  />

    <application ...>
           ...
    </application>
</manifest>

OTHER TIPS

I appreciate, I really do, that this question is nearly a year old! However I had the exact same issue, and it appears this is the only reference to this exact problem on the internet!

What was posted here didn't solve my issue, however it did point me in the direction of ProGuard. Since I have solved it, I wanted to post it so future people (perhaps me again) do not end up shouting at the monitor "Tertium, What did you see!" #xkcd.

Turns out I didn't have Proguard set up correctly. After much trial and error I found the following lines let me carry on:

 -keep class com.google.** { *; }
 -dontwarn com.google.**

To add a bit of background context:

  • I am building via Maven, android-maven-plugin
  • It is a LibGDX based game

This may not be the most optimal solution, but it was one that got me out of a hole.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top