I think I'm stuck between two bugs trying to get A...
# multiplatform
s
I think I'm stuck between two bugs trying to get Android Studio to behave nicely. Since updating to Kotlin 1.7.0, some libraries (moko-resources-compose) don't resolve in the IDE. https://issuetracker.google.com/issues/231701341 adding the workaround suggested there (adding commonMain to the androidMain srcDir) fixes that issue, but then androidMain doesn't seem to be able to resolve anything from commonMain, strangely. I've tried using almost every version of AGP and AS. currently I'm on dolphin with AGP 7.3.0-rc01. Has anyone else had this issue and figured out a working solution?
m
Is it a pure Android project or KMP/KMM?
s
KMP targetting android and jvm, using jetbrains compose
m
You could try to use the Android Dependency directly AS might complain about the double dependency but it helped in my case
s
I just tried that. Nothing changed.
m
Pity
s
Yeah, thanks for the suggestion.
m
I noticed that in some cases (libs only) enabling more variants (like iOS, js) to match those of the dependencies also solved that...but this is not always applicable (sry I cannot help you more)
e
Have you tried Electric Eel? That's the only version I've been able to get it to work with.
s
I have. I'll try it again.
With AGP 7.4 alpha?
e
You also need to remove
kotlin.mpp.hierarchicalStructureSupport=false
if you have it set in your gradle properties
With AGP 7.4 alpha
Yes, I'm using latest AS and AGP alpha
s
I appears to be the same as with dolphin. without the commonMain srcDir to androidMain, stringResource is an unresolved reference, and with adding the srcDir, nothing in androidMain can resolve things from commonMain
This is just in the IDE, everything builds fine either way.
e
Are you using the configuration cache?
s
Not as far as I'm aware.
e
Hmm that's odd, it's been working for me for a while now on EE
Do you see the same issue with the repro project in https://issuetracker.google.com/issues/231701341
s
I'm not sure. I see plenty of errors in the IDE. It looks like it's unable to resolve any external dependency.
e
🤔 I wouldn't expect any errors (at least that's the state in my machine).
s
I think Thursday I was not having a very smart day. Revisiting this, I realized I downloaded the version from that bug report. after changing the agp version to 7.4.0-alpha09, I get this error: e: /home/sproctor/Desktop/231701341/build-logic/src/main/kotlin/com/eygraber/galgal/gradle/kmp.kt: (3, 36): Unresolved reference: _ab93fe423733af93ad8bc6bc1a01bf3e
e
Oh that's something with the generated accessors where the package could change depending on a few factors. You can get it to work by replacing
_ab93...
with the correct package
s
Looks like it's either not being generated here or I'm completely blind this morning. The second option is a definitely possibility. Maybe 7.4.0-alpha02 was a hard dependency here. Anyway, thanks for trying.
e
If it's still not working you can try deleting your gradle cache. That worked for me a couple of times after having made all the other changes.
s
I think the original issue is fixed in 7.4.0-alpha10!