Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

打补丁包编译不通过 #1269

Closed
LoquatZ opened this issue Oct 24, 2019 · 8 comments
Closed

打补丁包编译不通过 #1269

LoquatZ opened this issue Oct 24, 2019 · 8 comments

Comments

@LoquatZ
Copy link

LoquatZ commented Oct 24, 2019

异常类型:编译异常导致打补丁包失败

手机型号:

手机系统版本:
tinker版本 1.9.14

gradle版本:5.4.1

是否使用热更新SDK: Bugly SDK

系统:Mac

堆栈/日志:

Task :app:transformClassesAndResourcesWithR8ForRelease
AGPBI: {"kind":"error","text":"'void com.joyapp.module_do_task.feature.task_detail.TaskDetailActivity.initRecycler()' cannot be mapped to 'b' because it is in conflict with an existing member with the same signature. This usually happens when compiling a test application against a source application and having short generic names in the test application. Try giving 'b' a more specific name or add a keep rule to keep 'void com.joyapp.module_do_task.feature.task_detail.TaskDetailActivity.initRecycler()'.","sources":[{}],"tool":"R8"}

以上日志只是一个方法,抛出的异常, 包内的近100个方法都出现 mapping 失败!

原以为是混淆时内联函数优化导致的,但是多次尝试均未能成功!

@LoquatZ LoquatZ changed the title gradle 3.5.1 打基本包的时候正常,但是打补丁包的时候一直编译不通过 打补丁包编译不通过 Oct 24, 2019
@nearbyren
Copy link

异常类型:编译异常导致打补丁包失败

手机型号:

手机系统版本:
tinker版本 1.9.14

gradle版本:5.1.1

是否使用热更新SDK: Bugly SDK

系统:Windows

堆栈/日志:

Task :app:transformClassesAndResourcesWithR8ForRelease
AGPBI: {"kind":"error","text":"'void com.joyapp.module_do_task.feature.task_detail.TaskDetailActivity.initRecycler()' cannot be mapped to 'b' because it is in conflict with an existing member with the same signature. This usually happens when compiling a test application against a source application and having short generic names in the test application. Try giving 'b' a more specific name or add a keep rule to keep 'void com.joyapp.module_do_task.feature.task_detail.TaskDetailActivity.initRecycler()'.","sources":[{}],"tool":"R8"}

我的解决方式是在gradle.properties 添加以下两行 【生成基包之前必须添加】。
android.enableR8.libraries = false
android.enableR8=false
因为是之前都是用Proguard进行代码混淆压缩,从android studio [3.3开始,提供R8配合Proguard规则进行混淆, @LoquatZ

@LoquatZ
Copy link
Author

LoquatZ commented Oct 25, 2019

@nearbyren 您知道不能开启R8的原因是什么么?那为什么打基本包的时候是可以成功的,打补丁包的时候就会编译不通过!问题是出在R8 还是 Thinker plugin

@nearbyren
Copy link

@LoquatZ 目前我也找不到原因!!!

@LoquatZ
Copy link
Author

LoquatZ commented Oct 25, 2019

@nearbyren 使用您提供的方法,可以正常打补丁包! 谢谢,但是还是想 知道一下原因,禁用R8会不会有什么隐患 !

@MhuiHugh
Copy link

MhuiHugh commented Jun 4, 2020

目前只能通过禁用R8解决吗

@TsuiYC
Copy link

TsuiYC commented Jun 17, 2020

@MhuiHugh 目前只能通过禁用R8解决。
@LoquatZ R8可以优化和缩减应用体积,同时也包含了针对Kotlin代码编译出来字节码专门的优化(也是影响包体积的)。目前R8也是推荐使用,不是必须的,禁用没有太大的影响。但是如果禁用后对你的包体积影响很大,你需要考虑要不要禁用,或者禁用后使用其他的方案来解决包体积问题(这种一般都是比较顶尖的团队面临的问题了,用户量都是上亿级了)。

@TsuiYC
Copy link

TsuiYC commented Jun 17, 2020

以上是我个人的一些观点,不成熟的地方还望纠正指教,谢谢。

@MhuiHugh
Copy link

以上是我个人的一些观点,不成熟的地方还望纠正指教,谢谢。
感谢回复,已禁用R8。能解决问题,还要啥自行车

@LoquatZ LoquatZ closed this as completed Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants