https://kotlinlang.org logo
Title
a

Anders Kielsholm

05/10/2022, 11:16 PM
Not sure if this is the appropriate channel, but hope you can help 🙂 After updating to Chipmunk (Android Studio), the editor editor suddenly states that there's an "unresolved reference" to one of my model classes (that's located in another module). I have two "core" modules (multiplatform with a JVM target), a shared (multiplaform with an Android target) module and my main android app module (standard Android module). The weird thing is that it builds and runs - it's just the editor that complains. Furhtermore, the references I have in the shared module to the core modules aren't complaining. And the references from the android module to the shared module is also fine. It's just that single reference from the Android module to the core module with my model classes. It wasn't an issue until yesterday when I updated to Chipmunk so I assume it's related to that. I tried downgrading gradle/AGP without any luck. Might just be a visual thing, but autocomplete is tottally broke when it comes to the model classes. Anyone else experiencing the same? Hope you'll be able to help - thanks in advance.
3
:yes: 4
👍 6
i

iamsteveholmes

05/11/2022, 6:28 AM
I had a similar problem that I couldn’t get rid of for many months. I believe the solution was to wipe out all of the meta-data and restore the IDE to default settings.
e

eygraber

05/11/2022, 7:01 AM
I tried that in the past with no luck, and just tried again with the same results. I think there's definitely something wrong in one of AGP, Kotlin, or Gradle, but I'm not sure which one, or what the problem is.
p

Paul Woitaschek

05/11/2022, 8:42 AM
Same issue here
m

Michael Paus

05/11/2022, 9:12 AM
Me too 🤨
o

Orhan Tozan

05/11/2022, 9:40 AM
Me too
I fixed it by reverting to Bumblebee
e

eygraber

05/11/2022, 12:31 PM
Which version of Bumblebee did you use? I tried patch 3 (which had worked in the past) but it didn't work this time.
o

Orhan Tozan

05/11/2022, 12:32 PM
patch 3. clear caches and remove all .idea folders/ build folders etc
p

Paul Woitaschek

05/11/2022, 12:32 PM
For us downgrading to agp 7.0.4 and using intellij worked 😛
☝️ 1
o

Orhan Tozan

05/11/2022, 12:32 PM
It works for me on agp 7.1.3
e

eygraber

05/11/2022, 1:51 PM
Tried Bumblebee again with AGP 7.1.3 and everything cleared, and still no luck. Then I tried it on a laptop that never had this project on it, or AS / Intellij installed, and it still didn't work. I'm going to try 7.0.4 and Intellij, but I think this won't get resolved until Google (or Jetbrains; still not sure what the cause is) looks into it.
m

Michael Paus

05/11/2022, 1:55 PM
I did not have any luck with IntelliJ and 7.0.4 but is anybody from JB or Google listening here?
e

eygraber

05/11/2022, 2:18 PM
There's usually a few of them. I imagine Google isn't paying much attention this week because of IO (and because I think their stance is that they don't officially support KMP yet). Kind of surprised that no one from Jetbrains has said anything either in slack or youtrack.
I just tried Bumblebee and Intellij with 7.0.4 and likewise had no luck with it.
a

Anders Kielsholm

05/11/2022, 6:09 PM
Sorry to hear so many have similar issues. I've tried with
kotlin.mpp.hierarchicalStructureSupport=false
(from the other thread) and think it is a good suggestion (with reference to https://kotlinlang.org/docs/multiplatform-hierarchy.html). It however didn't work, and when trying out some of the things suggested in that article I get
lateinit property targets has not been initialized
while syncing (similar to what's described here: https://youtrack.jetbrains.com/issue/KT-48504)
e

eygraber

05/11/2022, 6:14 PM
kotlin.mpp.hierarchialStructureSupport=false
definitely helped with some of the issues (like common modules in my project not getting recognized as a source set), but didn't help at all with external dependencies.
a

Anders Kielsholm

05/11/2022, 6:19 PM
I haven't really found any issues with external modules, only my own common module. So hopes that property would help.
I also just tried updating to Kotlin 1.6.21 without any luck 🤔
e

eygraber

05/11/2022, 7:48 PM
In case anyone is wondering, AGP 7.4.0 and Electric Eel don't fix the issue 😢
m

Michael Paus

05/11/2022, 7:59 PM
I am also using 1.6.21 since it was supported by Compose.
a

Anders Kielsholm

05/11/2022, 9:33 PM
Just tried a fresh clone of my project.. Still no luck 😕
e

eygraber

05/12/2022, 5:04 PM
Anyone from Google or Jetbrains that can help out here? KMP common dependencies aren't resolving in any IDE, and none of the "tricks" that used to help are working.
p

Paul Woitaschek

05/12/2022, 5:06 PM
@Sebastian Sellmair [JB] random desperate ping 🤞
j

Javier

05/12/2022, 5:25 PM
Adding Android to the only jvm target module fixes it but, obviously as a temporal workaround
1
e

eygraber

05/12/2022, 5:52 PM
I tried adding a jvm target to my Android target only kmp module but it didn't help.
j

Javier

05/12/2022, 5:52 PM
No, add Android to the only jvm target module
e

eygraber

05/12/2022, 5:53 PM
My setup is a little different then yours, so it's the same idea just swap Android and jvm
s

Sebastian Sellmair [JB]

05/13/2022, 8:56 AM
@Anders Kielsholm: Would you be available to look at your project together through Google Meet?
👍 1
a

Anders Kielsholm

05/13/2022, 9:00 AM
@Sebastian Sellmair [JB] Sure :) Just not possible today as I left my computer at home (where the issue is occurring) and I'm coming back late.
j

John O'Reilly

05/13/2022, 9:01 AM
@Javier could you clarify what you mean by "add Android to the only jvm target module" ?
p

Paul Woitaschek

05/13/2022, 9:02 AM
@Sebastian Sellmair [JB] I have approx one hour right now
j

John O'Reilly

05/13/2022, 9:04 AM
Be great if you guys, if you have a call, could summarise here what conclusions were....seems like people are consistently seeing regressions in this area with recent AS updates
👍 1
p

Paul Woitaschek

05/13/2022, 9:04 AM
I already tried to contact googlers regarding a possible test infrastructure that catches or at least notifies upon these issues
s

Sebastian Sellmair [JB]

05/13/2022, 9:09 AM
Lets maybe schedule some meeting on Monday, so that more people can participate? Generally, the AGP and AS team are in very close contact with us. Almost all automated tests with multiplatform run only against IJ releases. My personal opinion, as an engineer, not speaking for the Kotlin team, is that Kotlin Multiplatform should be used in IJ over AS. I know that you folks love to use brand new AGP versions, not supported in IJ, but using AS traditionally had more such issues, which is expected considering that tests for MPP are against IJ.
p

Paul Woitaschek

05/13/2022, 9:10 AM
If (the supported version of) agp wasn’t so much behind I’d love that 🤷
1
j

John O'Reilly

05/13/2022, 9:10 AM
I think one issue with that is that many people use Jetpack Compose in their KMM/KMP projects
👍 1
s

Sebastian Sellmair [JB]

05/13/2022, 9:11 AM
Just out of curiosity (not arguing with your priorities): Which AGP feature is not present int 7.0 that you would sacrifice red code in the IDE for?
j

Javier

05/13/2022, 9:11 AM
@John O'Reilly in my company project I had this issue and the multi platform module library had only jvm. I added android and the consumer started to show the imports. In a minimal repro I couldn't reproduce it because it was not happening
j

John O'Reilly

05/13/2022, 9:13 AM
I think particularly after recent I/O announcements that many people developing with Compose for example will want to use AS and related features included (e.g. LiveEdits in Electric Eel)
j

Javier

05/13/2022, 9:13 AM
@Sebastian Sellmair [JB] sadly the Android plugin in intellij is not merged with the enough cadence to allow to use intellij because I prefer intellij over android studio :(
The current stable version supports only 7.0.X and we are already on 7.2.X
p

Paul Woitaschek

05/13/2022, 9:15 AM
All that fancy stuff they just announced for android studio like recompositon highlighting, etc. Basically this page: https://developer.android.com/studio/preview/features/ the fixes from the gradle plugin: https://developer.android.com/studio/releases/gradle-plugin And the chipmunk stuff. Of cause I don’t want to sacrifice that for a red ide but I love new tech and it feels bad seeing fixes and new features many month after they are released
s

Sebastian Sellmair [JB]

05/13/2022, 9:27 AM
I know this is really hard to get right over Slack: Please folks: I am just an engineer (not even a support engineer), trying to help on Slack. I know people will really dislike this and will attribute a very negative sentiment towards what I am saying now (which is not my intention, but I am just not good in formulating it better). You folks are already talking about electric eel, getting excited about stuff presented in IO and I understand that. But folks: Multiplatform is still considered alpha. Electric Eel is canary 1 What are your expectations? A lot of your arguments are valid and being heard. I will talk to AS folks again, trying to share our tests with them. I will talk to IJ team merging the Android plugin back into IJ, seeing if there is something we can help. I will look into the reported project here and talk to the AGP/AS team. Let me share something with you that might be interesting: Android + Kotlin historically was a complicated integration! Android + Kotlin MPP was even much more complicated. Many things went wrong here, no stable APIs were provided and the teams got quite de-synced and some issues just had nobody feeling responsible for. There were even issues which nobody had tools and CI to fix (this sounds crazy, but I could give a whole conference talk about what happened here and how we tried to get out) Now, we’re working on making MPP stable. With this effort, the AGP and KGP teams are working very closely together. We’re agreeing on common APIs and we’re trying to finally fix the integration part. When this gets stable, you can expect tons of tests running at Google and things finally getting stable. We’re working on this extremely hard and we will get there. In the mean time, we’re trying to fix such issues on the fly, but we probably will not be able to fundamentally address the underlying issues on “why can this happen”. (We could, but this would just defer our “long term solution” more).
❤️ 8
👍 1
I hope you’re not demotivated by my message above! And I am certainly not trying to say, that it is your fault for using pre stable version of tools. Its our fault, that bugs and issues like this are possible and not catched by CI or QA. Full responsibility on us here! Be assured, we hear this complaints!
👍 4
p

Paul Woitaschek

05/13/2022, 9:29 AM
I think it would be good to have a page stating sth like what you described: That it’s in beta and that the tests are running against intellij and that kotlin multiplatform recommends intellij over Android Studio
s

Sebastian Sellmair [JB]

05/13/2022, 9:29 AM
Anyways: Let’s look into this particular issue on the project together on Monday? If somebody would be able to send me a reproducer zip beforehand, then the meeting would be much more efficient, but this is not a requirement. If you’re frustrated, you can also use this meeting to share your frustration with me and I can forward the feedback to relevant people!
j

John O'Reilly

05/13/2022, 9:30 AM
Definitely appreciate that this is a complex ecosystem and that of course people are working very hard to make these different parts work together. BTW just to clarify one point....I mentioned Electric Eel more as an example of why people developing with Compose for example would prefer to use AS over IJ....but particular issues being discussed here do seem to be present in current stable version of AS (and also seems to be regression as seemed to be ok in previous stable version).
👍 1
s

Sebastian Sellmair [JB]

05/13/2022, 9:37 AM
kotlin multiplatform Seb from the multiplatform team recommends intellij over Android Studio 😬 There is no official team opinion on that matter. I personally do have a strong opinion and I am basing this upon integration tests and the “time until a fix arrives”. There are other valid points of views and ways of weighting pros and cons. e.g. the KMM ide plugin might be an Argument for AS and this is developed also by our team for AS!
Btw: @Javier, thanks for pinging, mate :fist_bump: This, I guess was an important ping! Feel free to mark me more often to interesting threads! Obviously, there is a lot going on, but I am trying to read at least most of the feedback and issues!
👍 2
j

John O'Reilly

05/13/2022, 9:54 AM
@Sebastian Sellmair [JB] if you're looking for example of "red line" issues when using latest stable AS (though perhaps not exactly one initially described in this thread) then following should demonstrate it (and very open of course that this could be related to some misconfiguration I have). In this case (and with other projects) it's happening in
iOSMain
code https://github.com/joreilly/FantasyPremierLeague (also happening in PeopleInSpace project as well...other screenshot here from that)
j

Javier

05/13/2022, 9:57 AM
@Sebastian Sellmair [JB] I really hope that Google and JetBrains could work even closer by merging Android Studio into IntelliJ, or in other words, Google updating the Android plugin directly for IntelliJ. I know it is easier for Google to has its own fork so they are not depending on JetBrains dates and so on, but it is annoying in both directions. Having Android Studio as its own brand too, but... as developer I don't care a lot about that. As I said, I prefer IntelliJ because I want to use plugins that doesn't exist outside ultimate. I can't even preview a markdown file in Android Studio. And of course I would like to use the latest Android Studio features in IntelliJ, even I prefer to wait and keep using IntelliJ until those features are stable. Problem is when those stable features takes a lot of months to land into IntelliJ. Wonderful world: • Android Studio disappears • Android plugin in IntelliJ is maintained by Google • Android plugin has a selector to decide if you want to use stable or not stable version channels • KMP plugin with an AGP auto integrated inside of it so it hasn't to be applied manually
💯 4
p

Paul Woitaschek

05/13/2022, 9:59 AM
I have a public reproducer 😁 https://github.com/Kotlin/kmm-basic-sample
e

eygraber

05/13/2022, 3:01 PM
@Sebastian Sellmair [JB] thanks for all the info. I've run into the same issue with Intellij that I do with AS. I uploaded a repro project here https://issuetracker.google.com/issues/231701341 The steps are all for AS but they apply to Intellij as well as far as the common code not resolving. With Intellij I tried 7.0.4, and 7.1.3 with the Android plugin disabled.
@Sebastian Sellmair [JB]
I know people will really dislike this and will attribute a very negative sentiment towards what I am saying now
I can't speak for anyone else, but I really appreciate you saying all of this, and I have no negative sentiment towards what you are saying whatsoever 😄 Considering some of the other partners in the ecosystem won't talk to us at all, this is great.
Which AGP feature is not present int 7.0 that you would sacrifice red code in the IDE for?
It's not necessarily features (although it would be nice to use some of the newer ones), which typically come more from AS. For me, I'd like to use newer versions of AGP because some of the earlier 7.x versions had leaks or performance issues and didn't work that well with Gradle. It will also get more difficult to keep up with the ecosystem, as they tend to evolve in tandem (especially AGP and Gradle; they even synced their major version numbers). Some of the things not available in AGP 7.0.X include: • Cacheable lint • New publishing DSL • Fixes for Gradle configuration cache • R8 fixes • IDE integration fixes • Test fixtures I'd be happy to use Intellij for KMP as long as it allowed more recent versions of AGP.
You folks are already talking about electric eel, getting excited about stuff presented in IO and I understand that. But folks:
Multiplatform is still considered alpha.
Electric Eel is canary 1
What are your expectations?
Expectations might be weird. Google has been training us to think that there's nothing wrong with using an alpha in production. In my main project, most of my androidx dependencies are either in alpha, beta, or rc. They're almost never on a stable version.
There were even issues which nobody had tools and CI to fix (this sounds crazy, but I could give a whole conference talk about what happened here and how we tried to get out)
I'd pay 💰 to watch that talk
1
p

Paul Woitaschek

05/13/2022, 5:25 PM
Btw you can always inject another agp version when building the release
e

eygraber

05/13/2022, 5:28 PM
In some cases, but the DSL changed a bit between versions so it could get complicated
p

Paul Woitaschek

05/13/2022, 5:28 PM
Yeah I think square created a facade around that.
e

eygraber

05/13/2022, 5:28 PM
In any case 7.0.4 with Intellij doesn't work either, so I'm hoping whatever the fix is will work with newer versions of AGP
Yeah I think square created a facade around that.
Interesting, I'll look around for it
p

Paul Woitaschek

05/13/2022, 5:29 PM
For us 7.0 worked with intellij
e

eygraber

05/13/2022, 5:29 PM
Meaning 7.0.0 or 7.0.x?
p

Paul Woitaschek

05/13/2022, 5:29 PM
It won't help with config cache but that helps with using the latest agp on actual builds
The latest I think .4
e

eygraber

05/13/2022, 5:32 PM
Ah that's what I've been testing with. Well I guess I'll be waiting until Monday to try and figure out what's happening 😅
p

Paul Woitaschek

05/13/2022, 5:34 PM
Btw unrelated but maybe worth Sharing: we have 60ish modules and endless sync times. We have a Gradle property that allows excluding all iOS targets. When you use that you can also enable config cache. That and a m1max makes development blazingly fast as usually we don't need platform specific code at all.
m

Michael Paus

05/14/2022, 12:45 PM
I spent the whole morning trying to create a simple reproducer of the problem until I suddenly realized that my original problem was gone 😯 The good news: Everything works for me now. I can build and run all my code and it works. No more red unterlines in the editor. The bad news: I have not the slightest IDEA (wordplay) what triggered this change and I am afraid it might come back at any time soon. I didn’t even touch the module where I had the problem before. I just created a new project for the reproducer and tried to configure that so that it was as close as possible to the problematic module. For completeness here is my config:
IntelliJ IDEA 2022.1.1 (Community Edition)
Build #IC-221.5591.52, built on May 10, 2022
Runtime version: 11.0.14.1+1-b2043.45 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.3.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Non-Bundled Plugins:
    com.intellij.javafx (1.0.4)
    org.asciidoctor.intellij.asciidoc (0.37.17)
    com.gluonhq.plugin.intellij (2.8.6)
    androidx.compose.plugins.idea (221.5591.19)

Kotlin: 221-1.6.21-release-337-IJ5591.52
a

Anders Kielsholm

05/16/2022, 6:37 AM
To me, kmm-basic-sample unfortunately didn't seem to be a reproducer, at least when just opening it (without altering anything, but didn't have time to try to alter anything. Did you receive any reproducers, @Sebastian Sellmair [JB]? I wouldn't mind sending you my project, but can't 100% promise it will build on other machines as I need to change/remove our signing certificates.
s

Sebastian Sellmair [JB]

05/16/2022, 8:26 AM
For a more general call today: I can offer 17:00-18:00 CET Would also post this in the channel if at least a few folks have time there!
e

eygraber

05/16/2022, 9:05 AM
That time works for me
m

Michael Paus

05/16/2022, 9:33 AM
I’d be available at that time too.
s

Sebastian Sellmair [JB]

05/16/2022, 9:35 AM
Okay, then lets do a meeting where everyone can just share issues/general experiences and wishes? I will announce the link to the meeting in the channel soon!
👍 3
m

Michael Paus

05/16/2022, 9:57 AM
I have compiled a few questions which might trigger some thoughts and perhaps reveal some kind of pattern. • Is your project a KMP project with only JVM and Android targets? • Does the project have other module dependencies or is it a stand-alone project? • Do the problems show up in both IntelliJ IDEA and Android Studio? • Do you create a jar and aar artifact for ALL dependencies? • Do you use, directly or indirectly, any Java dependencies in commonMain? • Can you build your project via Gradle and the problem only shows up in the editor?
And the problem is back. Just in time for the online meeting: The editor is showing all red but Gradle builds and runs the project just fine.
p

Paul Woitaschek

05/16/2022, 1:01 PM
I can’t attend, need to pick up kids. But I have a pretty simple reproducer: https://github.com/PaulWoitaschek/kmm-basic-sample It’s just the official sample with the ios targets removed. commonMain isn’t picked up on chipmunk at all (see on the left, it’s shown as a plain folder) Would be great if others could check this out and see if it’s the same on their IDE
m

Michael Paus

05/16/2022, 2:19 PM
Just tried your sample with IntelliJ IDEA and did not have any problem. The program builds and runs on Android emulator just fine.
j

Javier

05/16/2022, 2:22 PM
The problem is not running, is marking as error things that are not error and when you run it even having those errors it works
m

Michael Paus

05/16/2022, 2:22 PM
Exactly. Look at my screenshot. It shows the same file without red underlines.
j

Javier

05/16/2022, 2:23 PM
Yeah, in IntelliJ I havent seen this issue, I haven't tried this repro in Android Studio. I am getting a different issue tho:
not sure if that error should exist, if it is, it should be a warning, not an error
m

Michael Paus

05/16/2022, 2:33 PM
Ahh, here we go. When I open the same project with AS chipmunk I get the same error as Paul.
I just did the recommended plugin updates (7.0.4 to 7.2.0) and now I get the same error indication as Javier.
j

Javier

05/16/2022, 2:55 PM
problem is in my company repo I am getting the issue with all versions
m

Michael Paus

05/16/2022, 2:56 PM
Well actually it is just indicating
The feature "multi platform projects" is experimental and should be enabled explicitly
j

Javier

05/16/2022, 2:57 PM
that issue is just annoying but it is not a blocker, the real issue is the other one 😞
the hard part I think it is not easy to reproduce consistently
m

Michael Paus

05/16/2022, 4:34 PM
The “multi platform” error vanished after I manually deleted the .gradle and .idea folders inside the project, as proposed in the online meeting. After that I was back at the original errors above.
j

Javier

05/16/2022, 4:36 PM
Is it possible to summarize here which problems and solutions where exposed in the meeting?
2
v

vanniktech

05/16/2022, 5:37 PM
It's hard. • CLI build is much simpler since it only looks at the source sets it needs (when building jvm jar it'll look at commonMain & jvmMain), IDE needs to look at everything and apply different mechanism to gather all the information it needs for displaying. Plus it does a lot more: linting, inspections etc • AS and IntelliJ use different internal representations. In case you have errors, try deleting
project/.gradle
&
project/.idea
directories & then re-sync everything. That should usually help. • For now when doing Kotlin Multiplatform use IntelliJ. There are plans to make more things from the tooling side stable which the Android Team might leverage to have better support for KMP within AS.
:thank-you: 2
👍 4
s

Sebastian Sellmair [JB]

05/17/2022, 7:57 AM
@Paul Woitaschek: Investigating, looking into your producer now!
👀 2
Nothing special, works with IJ fine, as far as I can see. Now opening with AS and debugging…
Opened the project in dolphin and
commonMain
is dead in the
:shared
module. With dead I mean, it is not recognised and imported by the IDE. This can easily be seen in the Project window, by it being a plain folder (not marked as source folder) Here is what is (most likely) going on breaking your IDE: In the online meeting, I explained, that AS and IJ used to have different internal representations for source sets (basically they were imported differently). IJ: Each Kotlin Source set <-> IJ module AS: Each Gradle Project <-> IJ module This is what this
legacy importing mode
is also talking about. Now the project in question here just has a single Target (android) defined. The Kotlin IDE plugin will detect that this is Android and that commonMain is effectively an Android source set as well (thats the intersection of all platforms). The plugin will expect Android being able to handle this source set and not run the import code. The expectation is that Android will also include this source set in its Project <-> IJ module representation. Now AS changed its internal representation and the expectation of the Kotlin IDE plugin might not be correct anymore leading to a source set that is effectively not handled by anyone. You can do an experiment: Just adding a
jvm()
target will resurrect commonMain again. I have seen this issue being discussed already internally. I will bring it up once again and ping necessary people.
👍 1
a

Anders Kielsholm

05/17/2022, 9:19 AM
@Sebastian Sellmair [JB] Thanks a lot that you're looking into this issue :) Where would you add the jvm() target? I tried in the shared module without any luck (might be me doing something wrong)
j

Javier

05/17/2022, 9:23 AM
it should be in the shared, maybe you have to delete the idea and .gradle folders
e

eygraber

05/17/2022, 9:27 AM
This helped me understand the issues that I'm seeing with my project. I got everything working in Intellij. I had still had
kotlin.mpp.hierarchicalStructureSupport=false
set from when I was testing with Android Studio. As soon as I removed it, Intellij started working 🥳 Now I wanted to see if I could make progress with Android Studio.
commonMain
source set is dead. So I put
kotlin.mpp.hierarchicalStructureSupport=false
back and now it is not dead; it shows a blue square. But common dependencies are still not resolving. So I remove
kotlin.mpp.hierarchicalStructureSupport=false
and add the following to my module's `build.gradle.kts`:
kotlin.sourceSets.named("androidMain") {
        kotlin.srcDir("src/commonMain/kotlin")
}
I did this because you mentioned that since IDE plugin is treating
commonMain
as part of Android (because it's the only target) and because of model changes no one is handling
commonMain
properly, I'd "help" it handle it. And it works! External common dependencies are now resolving. However, project level common dependencies aren't resolving now. I'm going to play with it a little more, but it seems like this could be a viable workaround for now.
This is with AGP 7.1.3 Using 7.2.0 or higher has the same behavior, but with new bugs. An Android (non multiplatform) module can't resolve external dependencies from some libraries, e.g. compose material and foundation aren't resolved, but compose runtime is.
s

Sebastian Sellmair [JB]

05/17/2022, 9:49 AM
Updating the project to AGP 7.2 and quickly checking as well.
(Btw I also updated the KGP version to 1.6.21, for obvious reasons!)
The particular project
kmm-basic-sample
seems unaffected by updating to 7.2 and re-syncing. @eygraber We will try to schedule a private call together, looking at your project. I will try to sync with the AS team looking what the current state of the issue here is
p

Paul Woitaschek

05/17/2022, 9:53 AM
It would be great if you can push that multiplatform ide support tests are part of the AS test suites as well
s

Sebastian Sellmair [JB]

05/17/2022, 9:58 AM
https://youtrack.jetbrains.com/issue/KTIJ-20137 https://partnerissuetracker.corp.google.com/issues/211083684
Marked as fixed.
This issue has been fixed in Android Studio Chipmunk Beta 3 / Dolphin Canary 3.
Pinged relevant issues that this seems to be still relevant! Let’s see what is going on!
a

Anders Kielsholm

05/17/2022, 10:02 AM
Unfortunately adding jvm() to the shared module didn't do the trick for me (I just tried deleting the grade and idea folders as well)
s

Sebastian Sellmair [JB]

05/17/2022, 10:03 AM
Did you re-sync the Gradle project?
a

Anders Kielsholm

05/17/2022, 10:13 AM
Actually thought that was done automatically when deleting those folders, but just tried agai and it didn't seem to do any difference. My commonMain is however also recognised as a module in AS (and was before as well as far as I remember)
s

Sebastian Sellmair [JB]

05/17/2022, 11:34 AM
Hmm, okay! I see! I am getting a little bit overloaded and its hard to context switch now. Let me think about how we can organise and detangle all the issues and how I can help the best here ☺️
👍 2
a

Anders Kielsholm

05/17/2022, 12:13 PM
That's totally fair, I think we've also mentioned a lot of projects. They all have similar looking issues, but might just be the same symptoms and not 100% the same issues :) Think it's great you (and the rest in here) is trying to help solve the issues :)
e

eygraber

05/17/2022, 11:53 PM
Just heard back from AGP that some of these issues were fixed in Electric Eel - https://issuetracker.google.com/issues/231701341 I tested my project in Canary 2 with the corresponding AGP version and it seems to work. You can see more details in my last comment on that issue, but if you only have one target, there's a hack where you need to add the commonMain directory to the android source set.
o

Orhan Tozan

06/28/2022, 11:33 AM
1,5 months later; does anyone know if Android Studio Chipmunk still gives multiplatform errors?
👀 6
m

MarkRS

06/28/2022, 12:39 PM
I'm still getting the errors (Chipmunk 2021.2.1 Patch 1, Kotlin 1.7.0, having tried all the suggestions in this thread [I think]) 😞
e

eygraber

06/28/2022, 12:41 PM
I believe at the end of the day that Electric Eel is needed to not have any errors
j

Javier

06/28/2022, 12:42 PM
I have the issue with Electric Eel, I haven't tried with Chipmunk (and I have to try with the latest IDEA EAP)
m

MarkRS

06/28/2022, 12:45 PM
Wow, that'll be a year, if not two, before there's a fix?
m

MarkRS

06/28/2022, 1:20 PM
@eygraber, did you get that working more completely than the message you're linking to suggests?
e

eygraber

06/28/2022, 1:23 PM
I think I did by using Eel. I'll check my project later to see exactly what I did, and I'll update here.
j

Javier

06/28/2022, 1:28 PM
@eygraber that workaround only works if you have only android target, right?
e

eygraber

06/28/2022, 3:12 PM
I haven't tried it with more than an Android target, but I'm assuming it wouldn't work very well
r

Racka N

07/03/2022, 2:53 PM
Sigh. Opened the project today and this issue came back. Tried latest Intellij EAP this time and still no luck. Electric Eel isn't giving me any confidence. Will try that later
Update on this: If you have gradle configuration cache enabled, just disable it and it should work. Though auto imports for any
expect
declarations won't work in
commonMain
or
commonTest
. But if you manually add the import there won't be any red lines for unresolved references. Tested this on AS Dolphin, Bumblebee, Chipmunk, Intellij 2021.3.1, 2022.2 EAP7. With Kotlin 1.7.0, AGP 7.2.1 and Gradle 7.4.2
v

vanniktech

07/09/2022, 1:05 PM
Configuration cache works with Kotlin 1.7.10 (it has an actual fix), whenever you executed a gradle command with CC it triggered a clean up of some files in .gradle which caused IntelliJ to reindex and then mark all imports as gone
r

Racka N

07/09/2022, 1:36 PM
Oh. Didn't know that.
p

Paul Woitaschek

07/09/2022, 3:54 PM
You mean it works for native targets too?
r

Racka N

07/09/2022, 3:57 PM
I don't have any project with native targets unfortunately. Only jvm, js and android
v

vanniktech

07/10/2022, 9:07 AM
I have ios, android + jvm targets. With Kotlin 1.7.10 and configuration cache on the terminal everything works for me (using 2022.2 Beta 1) although androidMain does not see commonMain from other modules (that should be fixed hopefully with 2022.2 Beta 2)
r

Racka N

07/10/2022, 12:04 PM
@vanniktech For my case, androidMain does see everything from commonMain (after I disabled the cache) but commonMain doesn't auto import any
expect
declarations even if they are in the same module. Manually importing them does work though and there are no longer any red lines in the project with the cache disabled. Though I haven't tried with cache enabled through terminal (I had it enforced in
gradle.properties
) and I'm still on 1.7.0 which doesn't have the config cache fixes
m

Marco Righini

07/25/2022, 7:50 AM
@Sebastian Sellmair [JB] do you have additional insights on the status of this mports issue to be fixed? 😀
r

Racka N

07/25/2022, 8:31 AM
@Marco Righini I use IntelliJ 2022.2 RC (release candidate) and the issue appears to be fixed. All my auto imports work, no red lines. Even in test sources (which I still had issues with even on EAP). This all works as long as I don't enable gradle configuration cache. It has fixed every issue I stated in my previous post with the exception of gradle configuration cache (which may solely be a gradle issue).
o

Orhan Tozan

07/25/2022, 10:40 AM
@Racka N Great, but I think people in the thread are using Android Studio 🙂
j

Javier

07/25/2022, 10:41 AM
From my side it is working in IntelliJ but I am still getting some other issues, for example, some missing imports from material extended icons that they exists and it compiles
I haven't tested AS Eel tbh
m

Marco Righini

07/25/2022, 10:42 AM
And next AS canary version will probably use 2022.2.1 🙃 Does somebody know if there’s somebody from Google tools team in this chan that could enlight us here?
s

Sebastian Sellmair [JB]

07/25/2022, 10:50 AM
@Marco Righini: Yes, many issues got fixed in 2022.2, there are some which we could not deliver in time: Expect those to be fixed in 2022.2.1 This whole incident at least has something pretty nice: We re-structured some parts of how we work together with Google. We did some changes to get the Android Plugin merged into IJ faster We are working together with the AS team to fix MPP issues We finally started to share tests with the AS team regarding MPP
👍 6
❤️ 5
👍🏾 1
r

Racka N

07/25/2022, 10:51 AM
@Orhan Tozan for AS the Google team said it should be fixed when the next AS releases are based on Intellij 2022.2. It's currently partially fixed in the latest AS Dolphin Beta and Electric Eel. No more red imports on my side but auto complete for imports doesn't pick up some things in commonMain/Test
j

Javier

07/25/2022, 10:52 AM
We did some changes to get the Android Plugin merged into IJ faster
That is really great, good job 😄
r

Racka N

07/25/2022, 10:54 AM
Thanks to the Android plugin being merged faster, I can now comfortably work on IJ and only open Android Studio to use AS specific tools like db, layout, network inspectors.
s

Sebastian Sellmair [JB]

07/25/2022, 10:54 AM
This whole situation with Import will sadly stay a pain point for some time. We are now moving faster here and we will get this stable, but keep in mind, that this will take time to get into stable releases of AS and IJ. Its also kind of a bootstrap problem: Making this stable is hard, because “it’s just an alpha feature”, therefore adjacent teams are free to ‘break’ things or be less careful (take this with few grains of salt, but you hopefully get what I mean). We will probably declare beta, and such issues might still appear. But next time a merge like this goes wrong, we are then free to block other teams and require fixing first!
So our velocity will increase further just by declaring beta status (even if we would have not touched a single line of code). Politics 🙌 ( <- sounds cynical, but was not my intention. I think this whole affair is somewhat fair)
j

Javier

07/25/2022, 10:55 AM
that this will take time to get into stable releases of AS and IJ.
What about EAPs? I usually work with the IntelliJ EAP even without this issue
s

Sebastian Sellmair [JB]

07/25/2022, 10:57 AM
EAPs are fine to use with MPP. I would even recommend them. I post warnings on twitter if known issues make it into EAP.
👍🏾 1
👍 1
:tnx: 1
m

Marco Righini

07/25/2022, 11:04 AM
@Sebastian Sellmair [JB] thanks! Those are awesome news. One thing https://kotlinlang.slack.com/archives/C3PQML5NU/p1658746214883879?thread_ts=1652224566.469179&amp;cid=C3PQML5NU there you meant 2022.2.3 or 2022.3.1 instead of 2022.2.1?
s

Sebastian Sellmair [JB]

07/25/2022, 11:07 AM
No I meant 2022.2.1 (this is the first patch release built from our 222 branch)
👍 1
m

Michael Paus

07/25/2022, 11:26 AM
@Sebastian Sellmair [JB] Would you like me to create an issue with the example I provided here: https://kotlinlang.slack.com/archives/C3PQML5NU/p1658744066723429?thread_ts=1658739054.975139&amp;cid=C3PQML5NU or do you have that already on your screen?
s

Sebastian Sellmair [JB]

07/25/2022, 11:29 AM
Yes, please! Just post the link to the issue also here, then I will be able to process this right away!
s

Sebastian Sellmair [JB]

07/25/2022, 11:50 AM
Thanks a lot. I processed this and assigned highest priority to the issue.
:thank-you: 1
m

Michael Paus

07/25/2022, 11:51 AM
Thanks a lot.
s

Sebastian Sellmair [JB]

07/26/2022, 8:06 AM
Reproduced your issue. This seems to be a problem within the Android Ide plugin. Will dispatch this to the AS team!
Done Will keep you updated in the ticket itself 👍
Android Studio Flamingo (based on 2022.2.1) just been released in canary channel
x

xxfast

11/22/2022, 11:34 PM
Ran into these issues with Android Studio Dolphin, Android Studio Electric Eel and InteliJ IDEA 2022.2. Downloaded Android Flamingo and all the unresolved references gone. Hoping flamingo gets stable soon, dont wanna be working on a canary build too long 😅
j

Javier

11/22/2022, 11:52 PM
Generally, I only use EAPs and canaries with no issues.
e

eygraber

11/23/2022, 12:14 AM
I find that canary 7 is the sweet spot. After that it gets progressively more and more unstable until the stable release when it is at its least stable. Then the cycle begins again 😅