2017-07-08 91 views
1

我加入火力地堡的gradle數據庫到我的Android項目,但gradle這個是無法build.I添加在我的應用程序和gradle這個在項目gradle這個我是一個谷歌的gradle產出的gradle火力地堡得到這個消息:無法建立火力gradle這個Android Studio中

enter image description here

這是我的應用程序gradle這個

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.3" 
    defaultConfig { 
     applicationId "iamrajendra.github.io" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.android.support:design:25.3.1' 
    testCompile 'junit:junit:4.12' 
    compile 'com.google.firebase:firebase-database:11.0.2' 

} 

,這是我的gradle項目

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

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

     // 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 
} 
+0

看一看這個https://firebase.google.com/docs/android/setup – iMAD

回答

2

我解決了這個問題。問題是圖書館

工作庫

implementation'com.google.firebase:firebase-database:10.0.0' 

如果教程的Android庫版本是11.01的版本,但這個版本是不是在Android的工作室工作

不靈庫

com.google.firebase:firebase-database:11.0.2 

在教程gradle dependencie這是錯誤的寫法。

https://firebase.google.com/docs/android/setup

0

你可以試試這個依賴,

// FirebaseUI數據庫只 編譯 'com.firebaseui:火力-UI-數據庫:2.0.1'

//單一目標,其中包括所有FirebaseUI庫上面 編譯「com.firebaseui:火力的UI:2.0.1」

+0

編譯 'com.firebaseui:火力-UI-數據庫:2.0.1' 我加入這個山牆但不工作 –

1

在您的應用程序gradle這個最後一行添加下面這個..在文件的底部

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

不工作的老闆我也加了這個 –

+0

您是否嘗試在SDK Manager中更新Google Play服務和Google Repository? – Mohad12211

相關問題