简体   繁体   English

构建发布版本的签名 APK 失败,但调试成功。 缺课

[英]Building signed APK of release build fails but debug succeeds. Missing class

When going to build the signed APK for my app if I select the debug build it compiles fine, but when I choose the release build it sits on在为我的应用程序构建签名的 APK 时,如果我选择调试版本,它编译得很好,但是当我选择发布版本时,它位于

:app:transformClassesAndResourcesWithR8ForRelease :app:transformClassesAndResourcesWithR8ForRelease

and it says它说

Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded引起:java.lang.OutOfMemoryError:超出GC开销限制

as well as

AGPBI: {"kind":"warning","text":"Missing class android.arch.paging.PositionalDataSource","sources":[{}],"tool":"D8"} AGPBI: {"kind":"warning","text":"缺少类 android.arch.paging.PositionalDataSource","sources":[{}],"tool":"D8"}

I have tried adding to my build.gradle(module)我曾尝试添加到我的 build.gradle(module)

dexOptions{
    javaMaxHeapSize "8g"
}

as well as adding some ignoring to the proguard.cfg以及在 proguard.cfg 中添加一些忽略

NOTE: I am using MacOS if that might have anything to do with it注意:我正在使用 MacOS,如果这可能与它有关

Proguard (which is turned on by default for release builds if I'm not mistaken) should be used very carefully.应该非常小心地使用 Proguard(如果我没记错的话,它默认为发布版本打开)。

ANY code that uses reflection might stop working if obfuscated so if you do want to use Proguard - you need to determine which classes are to be used with reflection and exclude (keep as is ) them.如果混淆,任何使用反射的代码都可能会停止工作,因此如果您确实想使用 Proguard - 您需要确定哪些类将与反射一起使用并排除(保持原样)它们。

More info here : https://www.guardsquare.com/en/products/proguard/manual/examples .更多信息请访问: https : //www.guardsquare.com/en/products/proguard/manual/examples

Good luck.祝你好运。

I had the same issue with the same stack trace.我对相同的堆栈跟踪有同样的问题。 In my case, there were missing org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=1024m -XX:MaxMetaspaceSize=1g -Dkotlin.daemon.jvm.options="-Xmx1g" configs in the gradle.propertis file.就我而言, org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=1024m -XX:MaxMetaspaceSize=1g -Dkotlin.daemon.jvm.options="-Xmx1g"中缺少org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=1024m -XX:MaxMetaspaceSize=1g -Dkotlin.daemon.jvm.options="-Xmx1g"配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SortedSet :: removeAll(headSet)失败,但从headSet派生另一个集合成功。 为什么? - SortedSet::removeAll( headSet ) fails, but deriving another collection from headSet succeeds. Why? 构建为发行版APK后出现错误,但调试APK则没有错误-错误:发现两个吸气剂或区分大小写的字段 - Error after building as release APK but no error with debug APK - Error: Found two getters or fields with conflicting case sensitivity 构建签名APK时出错 - error while building signed APK 构建签名 Apk 时出现 ClassCastException - ClassCastException while building signed Apk 签名的 apk 不能用作调试 apk java androidstudio - Signed apk is not working as debug apk java androidstudio 无法建立发行版APK - Unable to build release apk 我们可以在没有源代码的情况下将 Debug build APK 转换为 release Build - can we convert Debug build APK to release Build without having source code Maven构建成功,但是Eclipse构建失败 - maven build succeeds, but eclipse build fails Android Studio 卡在 √ Built build\app\outputs\apk\debug\app-debug.apk。 在将 Flutter 应用程序构建到 android 设备中时 - Android Studio Stuck at √ Built build\app\outputs\apk\debug\app-debug.apk. while building flutter app into android device 运行构建失败或成功取决于先前的构建 - Running build fails or succeeds depending on previous build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM