当我尝试构建代码时,错误仍然存在。我已经为所有实现提供了最新版本。另外我还没有使用过Firebase的Analytics(分析)工具,但是为什么会发生此错误?
我一直在逐一更新实现的版本,以减轻此类错误。
我的app/build.gradle
:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.ayushadarsh.odolog"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
//implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
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.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
//noinspection UseOfBundledGooglePlayServices
implementation "com.google.android.gms:play-services:12.0.1"
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
implementation 'com.google.firebase:firebase-ml-vision:19.0.3'
}
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
答案 0 :(得分:1)
这需要更改/更新为play-services-base:16.1.0
(未捆绑):
//noinspection UseOfBundledGooglePlayServices
implementation "com.google.android.gms:play-services:12.0.1"
并删除此行;仅仅是因为绘画问题并不能解决问题:
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
库com.android.support:appcompat-v7:28.0.0
和com.android.support:cardview-v7:28.0.0
也被添加了两次。而这个插件属于build.gradle
的底部:
apply plugin: "com.google.gms.google-services"
...这可以修复构建:
dependencies {
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:exifinterface:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support.constraint:constraint-layout:1.1.3"
implementation "com.google.firebase:firebase-core:16.0.8"
implementation "com.google.firebase:firebase-auth:16.2.1"
implementation "com.google.firebase:firebase-database:16.1.0"
implementation "com.google.firebase:firebase-ml-vision:19.0.3"
implementation ("com.google.android.gms:play-services-base:16.1.0") {
exclude group: "com.android.support", module: "support-v4"
}
implementation ("com.google.android.gms:play-services-auth:16.0.1") {
exclude group: "com.android.support", module: "support-v4"
}
implementation ("com.theartofdev.edmodo:android-image-cropper:2.6.0") {
exclude group: "com.android.support", module: " exifinterface"
}
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"
}
apply plugin: "com.google.gms.google-services"
答案 1 :(得分:0)
删除此
implementation 'com.google.android.gms:play-services:12.0.1'
更改
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
到
apply plugin: 'com.google.gms.google-services'