谷歌游戏服务:完成了非零退出值2
我不能让我的节目,由于我的摇篮里的一个问题来运行。我最近增加的依赖性:
I cannot get my program to run due to a problem inside my gradle. I recently added the dependency:
compile 'com.google.android.gms:play-services:7.3.0'
我的项目。我使用它映射在我的项目。但是,当我运行该项目,我得到这个错误:
to my project. I am using it for maps in my project. But when I run the project, I get this error:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72211Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42211Library UP-TO-DATE
:app:prepareComGithubShellSoftwareFab105Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable730Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
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)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 48.802 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
我相信这是由于上述的编译行,但我需要它为我的项目的一部分。我不能完全肯定在这里做什么。
I believe it's due to the compile line above, but I need it for part of my project. I'm not entirely sure what to do here.
编辑:这是我的整个build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.aszend.android"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile files('libs/aws-android-sdk-autoscaling-2.2.1.jar')
compile files('libs/aws-android-sdk-cloudwatch-2.2.1.jar')
compile files('libs/aws-android-sdk-cognito-2.2.1.jar')
compile files('libs/aws-android-sdk-core-2.2.1.jar')
compile files('libs/aws-android-sdk-ddb-2.2.1.jar')
compile files('libs/aws-android-sdk-ddb-mapper-2.2.1.jar')
compile files('libs/aws-android-sdk-ec2-2.2.1.jar')
compile files('libs/aws-android-sdk-elb-2.2.1.jar')
compile files('libs/aws-android-sdk-kinesis-2.2.1.jar')
compile files('libs/aws-android-sdk-lambda-2.2.1.jar')
compile files('libs/aws-android-sdk-machinelearning-2.2.1.jar')
compile files('libs/aws-android-sdk-mobilenalytics-2.2.1.jar')
compile files('libs/aws-android-sdk-s3-2.2.1.jar')
compile files('libs/aws-android-sdk-sdb-2.2.1.jar')
compile files('libs/aws-android-sdk-ses-2.2.1.jar')
compile files('libs/aws-android-sdk-sns-2.2.1.jar')
compile files('libs/aws-android-sdk-sqs-2.2.1.jar')
compile files('libs/Parse-1.9.1.jar')
compile 'com.github.shell-software:fab:1.0.5'
compile 'com.parse.bolts:bolts-android:1.2.0'
compile 'com.google.android.gms:play-services:7.3.0'
}
所有帮助鸭preciated
All Help Is Appreciated
它看起来像你的项目已超过65536的方法,从该行的错误:
It looks like your project has exceeded 65536 methods, from this line in the error:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
请参阅this回答。基本上,你有很多的进口图书馆,并在你的应用程序的方法,所有导入的库的总次数已经超过了极限。
See this answer. Basically, you have a lot of imported libraries, and the combined number of methods in your app and all imported libraries has exceeded the limit.
下面是一件事你可以尝试,挑选谷歌的各个部分播放,你需要导入整个库而不是服务。这里请参见文档。
Here is one thing you could try, pick and choose individual parts of Google Play Services that you need instead of importing the entire library. See documentation here.
所以,如果你只需要谷歌播放服务的地图,替换此:
So, if you only need Google Play Services for Maps, replace this:
compile 'com.google.android.gms:play-services:7.3.0'
通过这样的:
compile 'com.google.android.gms:play-services-maps:7.3.0'
和希望,将让你下面的极限!
And hopefully that will get you below the limit!