2017-05-01 2 views
3

erhalte ich diesen Fehler in der gradle Datei:Android Gradle konnte nicht lösen

Error: Failed to resolve: com.google.android.gms:play-services-measurement:10.2.4

-Install Repository and sync project

-Open File

-Show in Project Structure dialog

Aber ich benutze nicht die Play-Dienste-Messung in meiner app. Auf der anderen Seite passiert nichts, wenn ich auf den Link "Repository installieren und Projekt synchronisieren" klicke. Kann mir jemand dabei helfen? Ich habe Tage mit diesem Problem verschwendet.

Das ist mein voller gradle Datei:

apply plugin: 'com.android.application'  

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
} 



android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    compileOptions { 
     encoding "UTF-8" 
    } 


    lintOptions { 
     disable 'MissingTranslation' 
     abortOnError false 
    } 

    defaultConfig { 
     applicationId "xxx.yyy.zzz" 
     minSdkVersion 9 
     targetSdkVersion 25 
     versionCode 120 
     versionName "1.20" 
     multiDexEnabled true 
     //Enabling multi dex support due to exceeding the 65K methods dex limit imposed by Android: http://stackoverflow.com/questions/29756188/java-finished-with-non-zero-exit-value-2-android-gradle 
    } 
    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      applicationVariants.all { variant -> 
       variant.outputs.each { output -> 
        def formattedDate = new Date().format('yyyyMMddHHmmss') 
        def newName = output.outputFile.name 
        newName = newName.replace("app-", "MyAppName") 
        newName = newName.replace("-release", "-release" + formattedDate) 
        //noinspection GroovyAssignabilityCheck 
        output.outputFile = new File(output.outputFile.parent, newName) 
       } 
      } 
     } 

    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile project(':simple-crop-image-lib') 

    compile 'com.google.firebase:firebase-core:9.6.1' 
    compile 'com.google.firebase:firebase-messaging:10.2.4' 
    compile 'com.google.android.gms:play-services:10.2.4' //8.3.0' 10.2.4' 9.0.0' 9.6.0' 

    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support:mediarouter-v7:25.3.1' 
    compile 'de.hdodenhof:circleimageview:1.3.0' 
    compile 'com.android.support:recyclerview-v7:25.3.1' 
    compile 'com.android.support:design:25.3.1' 
    compile 'com.android.support:cardview-v7:25.3.1' 

    //For soap: 
    compile files('libs/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar') 

} 

apply plugin: 'com.google.gms.google-services' 

Antwort

1

Für mich war diese Zeilen aus dem "App build.gradle" zu entfernen:

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
} 

Und fügen Sie diese das "project build.gradle":

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.1' 
     classpath 'com.google.gms:google-services:3.0.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
8

aktualisieren Google Repository in Android SDK. Arbeiten für mich mit der Version 47.

Vom Feuerbasis doc:

dependencies { 
    // ... 
    compile 'com.google.firebase:firebase-core:10.2.4' 
    compile 'com.google.firebase:firebase-messaging:10.2.4' 
    // Getting a "Could not find" error? Make sure you have 
    // the latest Google Repository in the Android SDK manager 
} 
+2

Das neueste Google Repository zu bekommen, war der Trick. Vielen Dank. – karenms

+0

Gut zu wissen, dies ist nicht in der offiziellen Dokumentation https://firebase.google.com/docs/android/setup enthalten – tryp

Verwandte Themen