R8缩小:多次定义类型 [英] R8 minify: Type defined multiple times

查看:52
本文介绍了R8缩小:多次定义类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建签名发行版APK时,出现以下错误:

  .gradle/caches/transforms-2/files-2.1/532a317ccd54c8ae4f622faeb8b534a9/jetified-wordup-core-0.2.1-runtime.jar:de/codereddev/wordup/database/WordDao_Impl $ 5.class,多次定义类型de.codereddev.wordup.database.WordDao_Impl $ 5:/home/codered_dev/.gradle/caches/transforms-2/files-2.1/532a317ccd54c8ae4f622faeb8b534a9/jetified-wordup-core-0.2.1-runtime.jar:de/codereddev/wordup/database/WordDao_Impl$5.class,/home/codered_dev/MySoundboardApp/app/build/intermediates/javac/release/classes/de/codereddev/wordup/database/WordDao_Impl$5.class 

此Room DAO定义来自我创建自己的

这仅在发布时发生.我仍然可以构建并运行调试,而不会出现任何问题.

很遗憾,我找不到错误.希望这里的任何人都能对我有所提示.

我首先假设这可能是由于该库包含Room数据库的标准定义,并且使用该库的我的应用程序包含了拥有相同DAO的自己的自定义定义.因此注释处理器可能会两次处理DAO.但是我无法正确检查.

重要的是要知道:我也正在使用Koin进行依赖项注入.

解决方案

不幸的是,我不完全知道原因,但是我通过从库中删除Room kaptCompiler来使库正常工作,而只在应用程序使用该库.

When building a signed release APK I'm getting following error:

.gradle/caches/transforms-2/files-2.1/532a317ccd54c8ae4f622faeb8b534a9/jetified-wordup-core-0.2.1-runtime.jar:de/codereddev/wordup/database/WordDao_Impl$5.class,
Type de.codereddev.wordup.database.WordDao_Impl$5 is defined multiple times:
/home/codered_dev/.gradle/caches/transforms-2/files-2.1/532a317ccd54c8ae4f622faeb8b534a9/jetified-wordup-core-0.2.1-runtime.jar:de/codereddev/wordup/database/WordDao_Impl$5.class,
/home/codered_dev/MySoundboardApp/app/build/intermediates/javac/release/classes/de/codereddev/wordup/database/WordDao_Impl$5.class

This Room DAO definition comes from a library I created myself.

Looking into the .jar file I can find this:

This only happens on release. I can still build and run debug without any problems.

Unfortunately I can't find the error. Hopefully anyone here might have a hint for me.

I first assumed it might be due to the fact that the library contains a standard definition of a Room database and my application using the library contains its own custom definition holding the same DAOs. So annotation processors would maybe process the DAOs twice. But I couldn't check this properly.

If it's important to know: I'm also using Koin for dependency injection.

解决方案

Unfortunately I don't exactly know the reason but I got the library working by removing the Room kaptCompiler from the library and instead only have it in the app that is using the library.

这篇关于R8缩小:多次定义类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆