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

Incompatible with Android Gradle Plugin 7.3.0

Open softartdev opened this issue 3 years ago • 4 comments

After update classpath("com.android.tools.build:gradle:7.3.0") build failed:

> Task :shared:compileDebugKotlin e: /Users/.../MR.kt: (16, 74): Unresolved reference: app_name

softartdev avatar Sep 16 '22 20:09 softartdev

the same issue. Is there any workaround?

rsktash avatar Sep 17 '22 10:09 rsktash

Behaviour observed: a) If no other module depends on resources module (which contains MR), build fails. b) If the resources module is a dependency of some other module, for example any UI module, then the project builds successfully, however unable to access autogenerated object MR on android side. Autogenerated MR accessible in iOS code, xcode project builds and runs successfully.

After this workaround, project builds successfully, however unable to access MR on android Android fails to compile with AGP 7.3.0-beta03 #353

Could be unrelated but the warning below appeared for the first time:

Incompatible Kotlin/Native libraries
There are 3 third-party libraries attached to the project that 
were compiled with an older Kotlin/Native compiler and can't be read in IDE:
Gradle: dev.icerock.moko:graphics:iosMain:0.9.0
Gradle: dev.icerock.moko:resources:appleMain:0.20.1
Gradle: dev.icerock.moko:resources:iosMain:0.20.1
Please edit Gradle buildfile(s) and specify library a version compatible
with Kotlin/Native 1.7.10-release-for-android-studio. 
Then re-import the project in IDE.

Issue appeared after updating the Android GradlePlugin to 7.3.0 and Android Studio to Dolphin (2021.3.1)

Rolling back to AGP 7.2.2 as of now

msa1422 avatar Sep 17 '22 19:09 msa1422

rollback to android studio chipmunk helped me too

Sharprender avatar Sep 18 '22 08:09 Sharprender

it seems downgrading to AGP 7.2.2 can fix this problem temporary

kazemcodes avatar Sep 18 '22 10:09 kazemcodes

For me, adding this config solved the problem while using AGP 7.3.0

ln-12 avatar Sep 26 '22 10:09 ln-12

For me, adding this config solved the problem while using AGP 7.3.0

Have you tried to add new resources after upgrading AGP? For example, add a new string to the xml. For me, the MR object becomes inaccessible on Android side after applying the fix suggested by you.

msa1422 avatar Sep 26 '22 11:09 msa1422

Have you tried to add new resources after upgrading AGP? For example, add a new string to the xml. For me, the MR object becomes inaccessible on Android side after applying the fix suggested by you.

Yes, I can add another string, compile it and show it as text with compose.

ln-12 avatar Sep 26 '22 12:09 ln-12

Yes, I can add another string, compile it and show it as text with compose.

Can you please have a look at my sample project. I have applied this fix to following modules, but no success:

  • petsearch-shared:Shared - build.gradle

  • petsearch-shared:resources - build.gradle (module for shared resources)

msa1422 avatar Sep 26 '22 12:09 msa1422

Update: In my case, using the plugin in new Plugins DSL way has resolved the issue somehow.

plugins {
    kotlin("multiplatform")
    id("com.android.library")
    id("dev.icerock.mobile.multiplatform-resources") version "0.20.1" // Plugins DSL way
}

Installation procedure in README demonstrates the use of legacy plugin application.

With that said, autocompletion in Android Studio (Dolphin) is not working for shared resources. You have type it yourself and then IDE recognises the resource.

msa1422 avatar Oct 03 '22 11:10 msa1422

Same issue here :(

SamCosta1 avatar Oct 10 '22 10:10 SamCosta1

same problem. I've downgraded Android Studio Dolphin to Chipmunk. Is a solution in progress? @Alex009

softcleandev avatar Oct 10 '22 12:10 softcleandev

@In-12 response fixed my issue with AGP 7.3.0 ! Thx a lot ! https://github.com/icerockdev/moko-resources/issues/384#issuecomment-1257801201

Siddounet avatar Oct 14 '22 15:10 Siddounet

will be released in 0.21.0

Alex009 avatar Mar 24 '23 11:03 Alex009