moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

java.lang.NoSuchFieldError with Android Gradle Plugin 8.3.0

Open Faltenreich opened this issue 1 year ago • 10 comments

My project (link) crashes on start with the following exception after upgrading from Android Gradle Plugin 8.2.2 to 8.3.0, using version 0.23.0 of moko-resources:

FATAL EXCEPTION: main
Process: com.faltenreich.diaguard.beta, PID: 11114
java.lang.NoSuchFieldError: No static field tags of type I in class Lcom/faltenreich/diaguard/R$string; or its superclasses (declaration of 'com.faltenreich.diaguard.R$string' appears in /data/app/~~tI_khR_YrWC42LNPOtVWDQ==/com.faltenreich.diaguard.beta-8GoEXUJtIXrqQCR5je7ZxQ==/base.apk!classes17.dex)
at com.faltenreich.diaguard.MR$strings.<clinit>(MR.kt:382)

Thanks for any upcoming help and thank you for this awesome library, it is much appreciated!

Faltenreich avatar Mar 02 '24 17:03 Faltenreich

please try 0.24.0 alpha

Alex009 avatar Mar 11 '24 05:03 Alex009

Unfortunately 0.24.0-alpha-5 leads to the same problem.

Faltenreich avatar Mar 18 '24 19:03 Faltenreich

@Faltenreich Hi, I can't find in your link moko-resources for check, and github can't find any mentions moko in your project, can u create brach with reproducer of your problem, or send sample?

ExNDY avatar Apr 17 '24 07:04 ExNDY

@ExNDY I'm also encountering this error message. It happens when the Android gradle plugin is set to version 8.3.0 or higher. 8.2.2 is the last version that works

zt64 avatar Jul 08 '24 01:07 zt64

@zt64 Hi, maybe u can send reproducer? Because i'm have same projects with 8.3+ and no problem with plugin.

ExNDY avatar Jul 08 '24 01:07 ExNDY

@ExNDY

I've been trying to make a reproducer but I can't get it to produce the bug. However, in my own project I managed to fix it

At first I had the namespace in the android plugin and resources package set to the same package as all my code was in. I changed the resources package to its own package and the crash no longer occurs

zt64 avatar Jul 09 '24 18:07 zt64

@ExNDY Worked on it some more and got a working reproducer project. https://github.com/zt64/moko-resources-bug If I have the resources inside the common module then the crash doesnt occur, it only occurs when its in its own module

zt64 avatar Jul 09 '24 19:07 zt64

@zt64 Hi, I'm clearly understand problem with the same package of namespace? We can't detect this inside of plugin, because that work in Android Gradle plugin. But i think, we need add in readme info about separate namespace for all modules.

ExNDY avatar Jul 10 '24 00:07 ExNDY