LibGDX + com.google.android.gms: play-services: 7.0.0: android: dexDebug

I made a game with libgdx.

When I add the following line to gradle:

compile "com.google.android.gms:play-services:7.0.0"

      

It syncs correctly. But then I try to start my application and the following error appears:

Error:Execution failed for task ':android:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\[...]\Android\sdk2\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\[...]\android\build\intermediates\dex\debug --input-list=C:\[...]\android\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
    2
Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
        at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
        at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
        at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
        at com.android.dx.command.dexer.Main.run(Main.java:246)
        at com.android.dx.command.dexer.Main.main(Main.java:215)
        at com.android.dx.command.Main.main(Main.java:106)

      

Installed and updated Google Play support services and Android support.

+3


source to share


2 answers


You only need to selectively add the portion of Google Play Services that you really need. See this for reference.

https://developer.android.com/google/play-services/setup.html#Setup



Google Play services API    Description in build.gradle

Google+ com.google.android.gms:play-services-plus:7.0.0
Google Account Login    com.google.android.gms:play-services-identity:7.0.0
Google Actions, Base Client Library com.google.android.gms:play-services-base:7.0.0
Google App Indexing com.google.android.gms:play-services-appindexing:7.0.0
Google Analytics    com.google.android.gms:play-services-analytics:7.0.0
Google Cast com.google.android.gms:play-services-cast:7.0.0
Google Cloud Messaging  com.google.android.gms:play-services-gcm:7.0.0
Google Drive    com.google.android.gms:play-services-drive:7.0.0
Google Fit  com.google.android.gms:play-services-fitness:7.0.0
Google Location, Activity Recognition, and Places   com.google.android.gms:play-services-location:7.0.0
Google Maps com.google.android.gms:play-services-maps:7.0.0
Google Mobile Ads   com.google.android.gms:play-services-ads:7.0.0
Google Nearby   com.google.android.gms:play-services-nearby:7.0.0
Google Panorama Viewer  com.google.android.gms:play-services-panorama:7.0.0
Google Play Game services   com.google.android.gms:play-services-games:7.0.0
SafetyNet   com.google.android.gms:play-services-safetynet:7.0.0
Google Wallet   com.google.android.gms:play-services-wallet:7.0.0
Android Wear    com.google.android.gms:play-services-wearable:7.0.0

      

+5


source


LibGDX

is a fairly large library, have you either included multidex

or tried to remove unused code?

To do it just in build.gradle

`android {
   defaultConfig {
      ...
      multiDexEnabled = true
   }
}`

      



Try taking a look at this thread and see if it helps you if that's not a problem:

Unable to execute method id dex: not at [0, 0xffff]: 65536

+1


source







All Articles