且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android Studio 3.1中的任务':app:transformClassesWithAndroidGradleClassShrinkerForDebug'执行失败

更新时间:2023-01-25 15:14:08

似乎是Android Studio 3.1.1的错误。它的Android Profiler会注入一些ProGuard无法正确处理的其他代码。
手动构建APK或执行gradle命令不受影响。

It seems like a bug of Android Studio 3.1.1. It's Android Profiler injects some additional code that is not well-handled by ProGuard. Building APKs or executing gradle commands manually is not affected.

选项1:(首选) 禁用高级分析

选项2:在调试版本中禁用收缩

Option 2: Disable shrinking for Debug builds

选项3:在从Android Studio部署应用程序时包括okhttp库。 [可能仅用于调试功能] (如果进行测量,ProGuard会删除任何未使用的方法,不会有太大开销,可能会很有用)

Option 3: Include okhttp library while deploying app from Android Studio. [probably only for debug flavor] (may be useful if measuring something, ProGuard will remove any unused methods, will be no big overhead)

如果上述解决方案/快速修复不起作用,请确保您未使用okhttp。也许您是-并且配置不正确。您可以使用 gradle app:dependencies 检查okhttp是否在您的项目或任何链接的库中被引用。

If solutions/quickfixes above don't work, please make sure you are not using okhttp. Maybe you are - and it's not properly configured. You may use gradle app:dependencies to check if okhttp is referenced in your project or any linked libraries.