So I'm trying to develop an app with Android Studio. Everything was working fine. Then I wanted to run my app on the Virtual Device just as I did a few minutes before but it failed at synchronizing the Gradle build:
Error:Failed to resolve: com.google.android.gms:play-services-measurement:9.0.0 Install Repository and sync project
Open File
Show in Project Structure dialog
This is my Project Gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is my Module Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.stefan.myapplication"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ECLIPSE_.RSA'
exclude 'META-INF/ECLIPSE_.SF'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':org.eclipse.paho.android.service-1.0.2')
compile project(':org.eclipse.paho.client.mqttv3-1.0.2')
compile project(':android-beacon-library-2.8.1')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:support-v4:23.4.0'
}
apply plugin: 'com.google.gms.google-services'
So I researched and tried this: https://stackoverflow.com/a/37312564/6256209
and changed com.google.gms:google-services:2.0.0-alpha6
to com.google.gms:google-services:3.0.0
After that my Gradle Build would sync just fine within 5 seconds or so.
But it fails If I want to run it on the Virtual Device. It gives me 4 Errors:
Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Stefan\JEE\jdk1.7.0_75\bin\java.exe'' finished with non-zero exit value 2
All of them ending with finished with non-zero exit value.
So I found this: Java finished with non-zero exit value 2 - Android Gradle
And I tried to set multiDexEnabled to true and checked if I included unnecessary libs. I also clean and rebuild the app but nothing worked.
I'm really thankfull for any kind of help and advice