我是Android的新手,所以如果它是一个菜鸟问题,请耐心等待。
Gradle构建正常,但在设备上运行我的应用程序时出现此异常。
我只是尝试支持API 21到23,所以在升级到库的过程中,我最终得到了这个例外。我似乎无法解决它。 请帮忙!
**Exception**
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:preDexDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:116)
at com.android.ide.common.internal.WaitableExecutor$waitForTasksWithQuickFail$0.call(Unknown Source)
at com.android.build.gradle.tasks.PreDex.taskAction(PreDex.groovy:106)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:235)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:222)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 13 more
Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:42)
at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1296)
at com.android.builder.internal.compiler.PreDexCache.preDexLibrary(PreDexCache.java:122)
at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1248)
at com.android.builder.core.AndroidBuilder$preDexLibrary$5.call(Unknown Source)
at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy:150)
at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy)
Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:40)
... 6 more
BUILD FAILED
这是我的成绩档案。
apply plugin: 'com.android.application'
android {
// signingConfigs {
// config {
// keyAlias 'smartcheckinrelease'
// keyPassword 'smartzip'
// storeFile file('/Users/nlele/projects/apk signature/smartcheckinkeystorerelease.jks')
// storePassword 'smartzip'
// }
// }
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.smartzip.smartcheckin"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
lintOptions {
disable 'InvalidPackage'
}
}
repositories {
mavenCentral()
}
dependencies {
// compile 'cn.pedant.sweetalert:library:1.3'
// turning off this library as it has its own launcher icon causing below build error.
// Error:Execution failed for task ':app:processDebugResources'.
// > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/nlele/Library/Android/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1
compile 'com.commit451:NativeStackBlur:1.0.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.1.1'
compile fileTree(dir: 'libs', include: '*.jar', exclude: 'android-support-*.jar')
compile 'com.jakewharton:butterknife:6.0.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava:1.0.14'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1@aar'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
compile 'com.daimajia.slider:library:1.1.2'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
// compile project(':Downloads:JakeWharton-Android-ViewPagerIndicator-8cd549f:library')
compile 'com.android.support:recyclerview-v7:23.1.1'
// compile project(':myviewpagerindicator')
compile project(':myindicator')
// compile project(':MyViewAnimation')
compile 'com.daimajia.easing:library:1.0.2'
compile 'com.daimajia.swipelayout:library:1.2.0'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile project(':MyHelloCharts')
// compile 'com.inkapplications.viewpageindicator:library:2.4.3'
compile project(':MyCircleProgressIndicator')
compile 'com.getbase:floatingactionbutton:1.9.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'org.apache.httpcomponents:httpmime:4.5.1'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
compile 'org.apache.httpcomponents:httpclient:4.5.1'
compile 'com.google.code.gson:gson:2.3'
compile 'org.apache.httpcomponents:httpclient-cache:4.5.1'
compile 'com.amazonaws:aws-android-sdk-mobileanalytics:2.2.2'
compile 'com.github.gabrielemariotti.cards:cardslib-core:2.1.0'
compile 'com.github.gabrielemariotti.cards:cardslib-cards:2.1.0'
compile 'com.github.gabrielemariotti.cards:cardslib-recyclerview:2.1.0'
compile 'com.rockerhieu:rv-adapter-endless:1.1'
compile 'net.danlew:android.joda:2.8.2'
//retrofit Library
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
compile project(':AudioRecordLibrary')
compile 'org.solovyev.android.views:linear-layout-manager:0.5@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
}
答案 0 :(得分:0)
您遇到的问题(如此处的另一个答案所述)是对dex文件方法的限制。你有太多的库来适应旧的dex构建,它使用16位整数ID来引用方法。如果超过dex构建中的方法数(65,536),则会发生dex构建错误(http://developer.android.com/tools/building/multidex.html)。
你可以做一些事情来避免这个问题。
最终,像你正在做的更新可能会导致需要使用多索引构建。