Libgdx Google play service crash

6

To see guys I've been with this problem a long time, and I have not been able to fix it, I hope you can give me a little hand.

* I'm using eclipse moon

* Use LibGDX

* My app has ads

On very few devices my app crashes, in most the app works very well, the crash report is as follows:

09-11 19:31:59.656: E/AndroidRuntime(7022): FATAL EXCEPTION: main
09-11 19:31:59.656: E/AndroidRuntime(7022): java.lang.NoClassDefFoundError: android.support.v4.util.SimpleArrayMap
09-11 19:31:59.656: E/AndroidRuntime(7022):     at com.google.android.gms.ads.internal.zzs.<init>(Unknown Source)

After reading some similar questions, some answers suggested adding android-support-v4.jar

Well, I added it in the following way, drag the jar to the lib folder in proyecto-android Then I clicked right on the proyecto-android

properties-> java build path-> Libraries- > Add Jars   and here I added the jar that I had put in the folder lib

And now the following error occurs:

[ 2016-09-11 19:33:41 - Dex Loader] Unable to execute dex: method ID not in [0, 0xffff]: 65536 [2016-09-11 19:33:41 - proyecto-android] Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

Thanks in advance!

    
asked by Noel 12.09.2016 в 01:55
source

1 answer

4

When adding the jar what has happened is that you have exceeded the maximum number of methods (65k!) between your project and libraries.

You have two solutions, or add only the specific part of android-support-v4 that you need or activate the multidexing.

What I could not tell you is how to fix this using the Eclipse (without gradle), this exact problem was what made me migrate my developments Libgdx from Eclipse to IntelliJ .

My recommendation and the one of more people is that you migrate to another IDE (IntelliJ, Android Studio).

This question has already been answered in SOeng (not for Eclipse).

Google using multidex.

EDIT (Solution using gradle):

Normally the import that is usually the culprit is that of GooglePlay-services, the solution therefore is only to bring us the necessary part of the services. In your case it would be the announcements:

dependencies {
    compile 'com.google.android.gms:play-services-ads:versionQueUses'
}
    
answered by 12.09.2016 в 07:51