Iam able to build and run the whole project without any problems if I have minSdkVersion set to 17, but if I set minSdkVersion to 21 it gives me the following error, if I try to run the app (building still works fine).
I have read all the other suggestions about solving this problem, e.g. Cannot build android project using Android Studio - Gradle 1.7 but it did not solve my problem.
I started gradle with --debug and it gives me the output:
20:39:10.077 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
20:39:10.078 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'.
20:39:10.129 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
20:39:10.129 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled...
20:39:10.244 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe''
20:39:10.246 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
20:39:10.247 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with exit value 1 (state: FAILED)
20:39:10.254 [INFO] [org.gradle.api.Project] processing archive D:\Benutzer\Henrik\Eigene Dokumente\Project\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-appstate\8.1.0\jars\classes.jar...
ignored resource META-INF/
ignored resource META-INF/MANIFEST.MF
20:39:10.255 [ERROR] [org.gradle.api.Project] AGPBI: {"kind":"SIMPLE","text":"no classfiles specified","position":{},"original":"no classfiles specified"}
20:39:10.271 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':app:preDexDebug'
20:39:10.271 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :app:preDexDebug FAILED
20:39:10.272 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :app:preDexDebug (Thread[Daemon worker Thread 12,5,main]) completed. Took 1 mins 25.716 secs.
20:39:10.272 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 12,5,main]] finished, busy: 1 mins 32.723 secs, idle: 0.088 secs
20:39:10.277 [ERROR] [org.gradle.BuildExceptionReporter]
20:39:10.277 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
20:39:10.277 [ERROR] [org.gradle.BuildExceptionReporter]
20:39:10.278 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
20:39:10.278 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:preDexDebug'.
20:39:10.278 [ERROR] [org.gradle.BuildExceptionReporter] > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 1
20:39:10.278 [ERROR] [org.gradle.BuildExceptionReporter]
20:39:10.278 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
20:39:10.278 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
20:39:10.279 [LIFECYCLE] [org.gradle.BuildResultLogger]
20:39:10.279 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
20:39:10.279 [LIFECYCLE] [org.gradle.BuildResultLogger]
20:39:10.279 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 1 mins 38.519 secs
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "de.project.test"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.hannesdorfmann.mosby:mvp:2.0.0'
compile 'com.hannesdorfmann.mosby:viewstate:2.0.0'
compile 'com.google.guava:guava:18.0'
// Dagger 2 and Compiler
compile 'com.google.dagger:dagger:2.0.1'
apt "com.google.dagger:dagger-compiler:2.0.1"
compile 'javax.annotation:jsr250-api:1.0'
}
UPDATE If I delete all usages of 'com.google.android.gms:play-services:8.1.0' and the compile entry in the build-file it runs. So it runs if I don´t use 'com.google.android.gms:play-services:8.1.0' or if I set minSDK to 17, but this could not be the solution. Does anyone has an idea how I can use minSDK 21 and use the play-services especially google-maps?