将所有依赖项更新到最新版本后,错误仍然存在。
Build Gradle(app):
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public'}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.0.1'
}
Build.gradle(项目):
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.android.support:design:27.1.1'
implementation 'com.firebaseui:firebase-ui:2.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
}
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = trueapply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
构建项目后出现错误:
error: cannot access zu
class file for com.google.android.gms.internal.zu not found
答案 0 :(得分:1)
降级某些版本并在两个存储库中添加Maven网址。
Build Gradle(app):
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public'}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
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
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public'}
}
}
Build.gradle(项目):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.**.******"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-auth:10.0.1'
implementation 'com.firebaseui:firebase-ui:1.1.1'
implementation 'com.android.support:design:27.1.1'
}
在清单文件中:
android:supportsRtl="false"