https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

darkmoon_uk

09/17/2021, 2:35 PM
It seems that many MPP projects will want to be opened in both Android Studio and IntelliJ IDEA at some point. • Android Studio to work with the latest tooling on the Android side (Compose previews) • IntelliJ to gain access to JVM debugging for the Desktop/Server parts - because JVM debugging doesn't work at all, by design, on AS? I'm there now: Gradle config is mostly compatible between the two, the blocker is the different Android Gradle Plugin version required by each IDE. How are people dealing with this? • Having entirely separate Gradle projects to open in each IDE? • Or working with a lowest-common denominator Android config that works with either Gradle plugin? • Not using Android Studio and only using IntelliJ for all parts of the project? This is a barrier to adoption for MPP + Compose. It would be enough if I could just ignore the Android plugin and targets when opening in IntelliJ, but that's easier said than done because if you switch off the plugin, other syntax becomes invalid.
3
👀 1
☝️ 2
j

Javier

09/17/2021, 3:07 PM
2
Personally, I hope a lot I can just use the latest stable version of AGP in the latest stable IntelliJ IDEA, but now it is an awful experience, because the delay until AGP supports the latest IDEA is counted in months...
d

darkmoon_uk

09/17/2021, 3:23 PM
That's interesting @Javier, I didn't realise that AGP latest actively prevents itself being used in IntelliJ. I suppose it's a matter of who is going to put in the testing effort as well.
j

Javier

09/17/2021, 3:24 PM
personally I would like to have a "force" option to try to use the latest agp, maybe it just works
3
d

darkmoon_uk

09/17/2021, 3:24 PM
Starred FWIW. I hope JetBrains and Google can come up with some kind of solution, I'm not even talking about having full functionality in both IDE's - just a way that we can even open a mixed MPP project at all, to use the current support from each IDE.
I can think of one way to achieve it, by having totally separate Gradle root projects for each IDE, then flat include all the project submodules.
That's quite a lot of structural upheaval in my project for the sake of one plugins 'artificial' incompatibility 😞
j

Javier

09/17/2021, 3:27 PM
the problem is 4.2.2 can have different configs which break with 7.0.2
like the new way to declare sdk versions
so maintaing two different configs is just... 💤
d

darkmoon_uk

09/17/2021, 3:28 PM
Yes there are creeping differences in their syntax, some of which can be worked around, but it starts to get like walking on ice.
Also e.g.
7.0.2
Copy code
buildTypes {
    release {
vs.
4.2.2
Copy code
buildTypes {
    getByName("release") {
It's confronting, because now I can't debug my Server and Desktop parts at all.
j

Javier

09/17/2021, 3:31 PM
getByName should work on 7.0.2, no?
d

darkmoon_uk

09/17/2021, 3:31 PM
Yes that will, but just an example where there's drift in the recommended syntax.
I think I'll have another go at trying to achieve the lowest denominator syntax between the plugins.
Did you try, or have any luck with that?
j

Javier

09/17/2021, 3:33 PM
no, probably if you dont migrated the deprecated properties to the new 7.0.2 approach it should work without doing nothing
d

darkmoon_uk

09/17/2021, 3:33 PM
I have this in my
buildSrc
BTW:
Copy code
val AndroidGradlePlugin = when (BuildSettings.environment) {
            BuildEnvironment.IntelliJ -> "4.2.2"
            else -> "7.1.0-alpha11"
        }
j

Javier

09/17/2021, 3:33 PM
just changing from 4.2.2 to 7.0.2
not sure about 7.1 tho
👍 1
m

mbonnin

09/17/2021, 6:03 PM
I've been trying all kind of things. Since I don't use Compose that much, I tend to stay on AGP 4.2.2 + IntelliJ.
I've had some success ignoring parts of the build with
Copy code
if (System.getProperty("idea.sync.active") == null) {
      // Do some stuff with AGP
    }
Maybe there's a property that allows differentiating between AS/IntelliJ where you can change the logic/plugin versions/etc..
But I'm eagerly waiting on AGP 7.x to be compatible with IntelliJ too
m

Mărcuţ Andrei

09/20/2021, 10:37 AM
Could this option be a workaround - to turn .iml project files to ON in AS and separately keep IJ with the .idea folder? Haven’t tried it myself, just an idea.
5 Views