无法为摘要 class 'GoogleServicesTask' 创建代理 class。 'com.google.gms:google-services:4.3.4'
Cannot create a proxy class for abstract class 'GoogleServicesTask'. with 'com.google.gms:google-services:4.3.4'
昨晚将 Fabrics crashlytics 升级到 Firebase。
当我尝试重建应用程序时,它遇到了很多问题,我一个一个地解决了这些问题,但最后一个被卡住了:
Cannot create a proxy class for abstract class '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
}
}
在我的 app/gradle 文件中
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'
我在更新我们的一个旧项目时遇到了同样的问题。
对我有用的是我将这两个依赖项降级为
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
最好更新这个过时的Android Gradle插件:
classpath "com.android.tools.build:gradle:3.4.2"
一个版本,与 Android Studio 的版本匹配...
classpath "com.android.tools.build:gradle:7.0.2"
我在 Google 发布后就遇到了这个问题
com.google.gms:google-services:4.3.4
通过将版本降低到 4.3.3,它又对我有用了。
com.google.gms:google-services:4.3.3
这不是上述问题的直接答案,但我搜索的所有错误经常让我看到这个条目……我们的解决方案就在这个 space 中和周围。所以我希望这能帮助那些最终来到这里的迷失灵魂。如果我在有合适的词语时提出答案,我会 link 从这里开始。
我们的最终答案是升级到 6.5 gradle 和 4.1.1 Android Studio(当时最新的)但是当我们这样做时,这个错误本身解释得比仅仅更好一个班轮。它实际上告诉您失败的原因并提示如何修复它:
您的口味名称可能有所不同,但错误类似于:
任务“:app:processArmeabiv7aDebug”执行失败。
No matching client found for package name '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
文件会在 运行ning.
后自动创建
昨晚将 Fabrics crashlytics 升级到 Firebase。
当我尝试重建应用程序时,它遇到了很多问题,我一个一个地解决了这些问题,但最后一个被卡住了:
Cannot create a proxy class for abstract class '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
}
}
在我的 app/gradle 文件中
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'
我在更新我们的一个旧项目时遇到了同样的问题。 对我有用的是我将这两个依赖项降级为
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
最好更新这个过时的Android Gradle插件:
classpath "com.android.tools.build:gradle:3.4.2"
一个版本,与 Android Studio 的版本匹配...
classpath "com.android.tools.build:gradle:7.0.2"
我在 Google 发布后就遇到了这个问题
com.google.gms:google-services:4.3.4
通过将版本降低到 4.3.3,它又对我有用了。
com.google.gms:google-services:4.3.3
这不是上述问题的直接答案,但我搜索的所有错误经常让我看到这个条目……我们的解决方案就在这个 space 中和周围。所以我希望这能帮助那些最终来到这里的迷失灵魂。如果我在有合适的词语时提出答案,我会 link 从这里开始。
我们的最终答案是升级到 6.5 gradle 和 4.1.1 Android Studio(当时最新的)但是当我们这样做时,这个错误本身解释得比仅仅更好一个班轮。它实际上告诉您失败的原因并提示如何修复它:
您的口味名称可能有所不同,但错误类似于: 任务“:app:processArmeabiv7aDebug”执行失败。
No matching client found for package name '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
文件会在 运行ning.