2017-07-24 59 views
1

我添加了firebase UI庫,添加Google maven後出現錯誤。 可能的原因是我使用的Android Gradle插件版本不包含該方法,但我升級了插件並仍然出現錯誤。未找到Gradle DSL方法:添加firebaseui庫後的'classpath()'

這裏是模塊搖籃文件:

apply plugin: 'com.android.application' 


repositories { 
    mavenLocal() 
    flatDir { 
     dirs 'libs' 
    } 
} 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     applicationId "com.google.firebase.udacity.friendlychat" 
     minSdkVersion 16 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled = true 

    } 
    dexOptions { 
     javaMaxHeapSize = "4g" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/LICENSE-FIREBASE.txt' 
     exclude 'META-INF/NOTICE' 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 

    compile 'com.android.support:design:24.2.0' 
    compile 'com.android.support:appcompat-v7:24.2.0' 

    // Displaying images 
    compile 'com.github.bumptech.glide:glide:3.6.1' 
    compile 'com.google.firebase:firebase-core:11.0.2' 
    compile 'com.google.firebase:firebase-storage:11.0.2' 
    compile 'com.google.firebase:firebase-auth:11.0.2' 
    compile 'com.google.android.gms:play-services:11.0.2' 
    compile 'com.firebaseui:firebase-ui:2.1.0' 



} 

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

和項目搖籃文件:

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

buildscript { 
    repositories { 
     jcenter() 
     mavenLocal() 
    } 
    } 
    dependencies { 
     apply plugin: 'idea' 
     classpath 'com.android.tools.build:gradle:2.2.2' 
     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 { 
     maven { 
      url "https://maven.google.com" 
     } 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

回答

0

改變項目搖籃文件後,我已經得到了解決:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.2' 
     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() 
     } } 
0

你有一個}不在它的位置。

buildscript { 
    repositories { 
     jcenter() 
     mavenLocal() 

    } 
    dependencies { 
     apply plugin: 'idea' 
     classpath 'com.android.tools.build:gradle:2.2.2' 
     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 { 
     maven { 
      url "https://maven.google.com" 
     } 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 
相關問題