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

Lambda 表达式导致的NoClassDefFoundError 错误 #55

Open
JarvisBuop opened this issue Jun 22, 2021 · 6 comments
Open

Lambda 表达式导致的NoClassDefFoundError 错误 #55

JarvisBuop opened this issue Jun 22, 2021 · 6 comments

Comments

@JarvisBuop
Copy link

在使用qigsaw 插件化项目的时候,遇到了split中使用lambda表达式在打release包混淆时,打包可以成功,但在运行lambda表达式处会crash,其中R8和Proguard混淆都会报NoClassDefFoundError错误,请问这可能是什么原因导致的,应该怎么解决呢?

我尝试了以下方法都无效:

  1. 添加 lambda表达式 的混淆;
  2. android.enableR8=false 关闭R8,使用Proguard也会crash;
@JarvisBuop
Copy link
Author

demo复现步骤: @kissonchan

  1. :java 模块 先添加
    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
  2. JavaSampleActivity类布局添加id,onCreate中添加
    findViewById(R.id.text).setOnClickListener(v -> {
    Log.e(TAG,"doError");
    });
  3. clear 后使用R8或者proguard 运行 qigsawAssembleRelease
  4. 打完包后进入app,点击text文字会出现NoClassDefFoundError

@Hackforid
Copy link

Hackforid commented Jul 15, 2021

因为Lambda表达式desurge生成的class被留在的host中
这是dynamic feature dex split的坑,解决方案是自己改R8,让lambda class正确的放在split中

@Xiaojuanmao
Copy link

因为Lambda表达式desurge生成的class被留在的host中
这是dynamic feature dex split的坑,解决方案是自己改R8,让lambda class正确的放在split中

活捉

@wille-89
Copy link

apply plugin: 'com.iqiyi.qigsaw.dynamicfeature'
用了这个 plugin 还会出现吗?这个 plugin 改了 Scope 的范围,我这边验证是不会有问题

@xiangtailiang
Copy link

因为Lambda表达式desurge生成的class被留在的host中
这是dynamic feature dex split的坑,解决方案是自己改R8,让lambda class正确的放在split中

官方有对应的issue:https://issuetracker.google.com/issues/181185126
我测试过,AGP7.0可以解决这个问题。但Qigsaw还没适配7.0,大佬有计划适配吗?

@JarvisBuop
Copy link
Author

JarvisBuop commented Nov 26, 2021

多classloader下混淆的lambda表达式位于host的问题 后续:

  1. 单独升级R8,个人尝试R8 3.0.62版本已经解决这个问题了; (ps:对应agp7.0, qigsaw未支持agp7.0)
    2.使用单Classloader模式;

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

5 participants