2016-07-20 36 views
7

我收到以下错误,而在摇篮加入Firebse远程配置文件SDK未能解决:编译“com.google.firebase:火力-配置:9.2.1”

compile 'com.google.firebase:firebase-config:9.2.1' 

它将显示错误的错误:(25,13)无法解析:com.google.firebase:火力-配置:9.2.1 显示在文件
显示在项目结构对话框

摇篮文件:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.0" 

    defaultConfig { 
     applicationId "com.bazingalabs.firebaseremoteconfig" 
     minSdkVersion 15 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.0.0' 
    compile 'com.google.firebase:firebase-config:9.2.1' 


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

误差图像enter image description here

+0

您是否已经向您的根build.gradle文件中添加了classpath'com.google.gms:google-services:3.0.0' –

+0

您可以准确发送您添加此行的位置吗?我们需要确保它位于正确的位置。 –

+0

发布您的* gradle *结构。 –

回答

18

@RiyazAhamed谢谢。解决方案是从sdk经理更新'Google Play服务'和'Google Repository',并重新启动Android studio。

0

添加此下方的依赖关系:

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

已添加仍显示错误,还在项目级gradle文件 –

+0

中添加classpath'com.google.gms:google-services:3.0.0'尝试更新您的sdk管理器 – Dharmaraj

0

有这一个错误:

添加到您的文件的gradle。

packagingOptions { 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/LICENSE-FIREBASE.txt' 
    exclude 'META-INF/notice' 
} 

我用火力地堡消息

它应该是这样的

摇篮:应用

apply plugin: 'com.google.gms.google-services' //Usually they put this at the bottom (below dependencies {} 
               // but it worked for me at the top also 

android { 
    defaultConfig { ... } 
    buildTypes { .... } 

    packagingOptions { 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/LICENSE-FIREBASE.txt' 
     exclude 'META-INF/notice' 
    } 
} 

dependencies { 
     compile fileTree(include: ['*.jar'], dir: 'libs') 
     testCompile 'junit:junit:4.12' 
     compile 'com.google.firebase:firebase-core:9.2.1' 
     compile 'com.firebaseui:firebase-ui:0.3.1' 
     compile 'com.google.firebase:firebase-messaging:9.2.1' 
} 

摇篮:项目

dependencies { 
    ... 
    classpath 'com.google.gms:google-services:3.0.0' 

}