如何解决无法为抽象类“ GoogleServicesTask”创建代理类与“ com.google.gms:google-services:4.3.4”
昨晚将Fabrics crashlytics升级到Firebase。
当我尝试重建该应用程序时,它遇到了很多问题,我一一解决了这些问题,但最后一站却卡住了:
无法为抽象类“ GoogleServicesTask”创建代理类
app / build
buildscript {
ext.kotlin_version = '1.3.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
我的应用程序/毕业文件中有
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.xxx.xxxx"
minSdkVersion 19
targetSdkVersion 29
versionCode 23
versionName "1.1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
firebaseCrashlytics {
mappingFileUploadEnabled false
}
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
}
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies { my all dependencies}
apply plugin: 'com.google.gms.google-services'
解决方法
我在Google发布后马上遇到了这个问题
com.google.gms:google-services:4.3.4
仅将版本降低至4.3.3,对我来说再次起作用。
com.google.gms:google-services:4.3.3
更好地更新这些毫无希望的过时构建工具:
classpath "com.android.tools.build:gradle:3.4.2"
到当前版本(与Android Studio版本匹配):
classpath "com.android.tools.build:gradle:4.0.1"
,
更新一个旧项目时遇到同样的问题。 对我有用的是我将这两个依赖项降级为
classpath'com.google.gms:google-services:4.3.3'
,classpath'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
这不是上面的直接答案,但是我搜索的所有错误经常将我发送到该条目...而我们的解决方案是在此领域内或周围。因此,我希望这可以帮助最终迷失灵魂的人。如果我在有正确的单词的情况下提出答案,则会从此处链接到它。
对我们来说,最终的答案是升级到6.5 gradle和4.1.1 Android Studio(当时是最新版本),但是当我们执行此错误时,可以说明自己的方式比仅仅使用一个衬套更好。它实际上告诉您失败的原因,并提示如何解决此问题:
您的口味名称可能有所不同,但错误类似于: 任务':app:processArmeabiv7aDebug'的执行失败。
未找到与包名称'com.yourcompany.appname.debug'相匹配的客户端
我们在调试版本中添加了后缀,以便可以并行安装。但是我们做不到的是在google-services.json中输入了一个条目!
较旧的Android Studio / Gradle版本组合根本没有提供错误的上下文。希望有一天能对某人有所帮助。可能不是最终答案(请参阅升级说明),但是对于那些出于某种原因而使用较旧工具的用户,此答案将有助于找到该答案的迷路者。
,在 android/build.gradle
中像这样更改您当前的 gradle 版本:
classpath "com.android.tools.build:gradle:4.0.1"
同时,更改您的 gradle-wrapper.properties
文件并用这一行替换最后一行:
distributionUrl = https\://services.gradle.org/distributions/gradle-6.5-all.zip
然后只需删除、gradle-wrapper.jar
和运行您的项目。不用担心运行后会自动创建gradle-wrapper.jar
文件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。