gpt4 book ai didi

android - 使用 proguard 生成签名的 APK 时出错 - Project with GMS

转载 作者:行者123 更新时间:2023-11-30 00:38:39 25 4
gpt4 key购买 nike

尝试使用 proguard 生成分配的 APK 时出现错误。下面是返回的消息:

  Warning: com.google.gms.googleservices.GoogleServicesPlugin: can't find superclass or interface org.gradle.api.Plugin
Warning: com.google.gms.googleservices.GoogleServicesPlugin: can't find superclass or interface groovy.lang.GroovyObject
...
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.

将 Firebase Cloud Messaging 添加到项目后,问题开始出现。在我的 build.gradle 文件下面。

  apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId 'com...'
minSdkVersion 15
targetSdkVersion 25
versionCode 29
versionName "2.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
resConfigs "en", "pt", "fr", "es", "it", "de", "ru"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
}

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

现在是我的 proguard-rules.pro 文件。

  -keep class org.gradle.api.** { *; }
-keep interface org.gradle.api.** { *; }

-keep class groovy.lang.** { *; }
-keep interface groovy.lang.** { *; }

-keep class sun.misc.** { *; }
-keep interface sun.misc.** { *; }

-keep class org.codehaus.groovy.runtime.** { *; }
-keep interface org.codehaus.groovy.runtime.** { *; }

-keep class org.codehaus.groovy.reflection.** { *; }
-keep interface org.codehaus.groovy.reflection.** { *; }

-keep class com.google.gson.** { *; }
-keep interface com.google.gson.** { *; }

我已经尝试了所有有互联网的东西。

最佳答案

你有以下依赖:

compile 'com.google.gms:google-services:3.0.0'

不是您的 Android 应用程序应该包含的依赖项,而是可以包含在 classpath 部分中的一行。

删除该依赖项。

关于android - 使用 proguard 生成签名的 APK 时出错 - Project with GMS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42939885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com