I’ve got a problem with IntelliJ. Every time I’m t...
# intellij
k
I’ve got a problem with IntelliJ. Every time I’m trying to apply a new plugin to my Multiplatform project I’m getting a lot of “unresolved reference” for stuff that previously was working and the information that some of my modules were removed by the Gradle project (“The IDE modules below were removed by the Gradle project reload”). In these modules IDE support is not working anymore (autocompletion etc.) and generally seems like they are not useable at all. You can see the behavior on the video below (more details in the thread)
IntelliJ IDEA 2020.2.3 (Community Edition) Build #IC-202.7660.26, built on October 6, 2020 Runtime version: 11.0.8+10-b944.34 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.15.7 GC: ParNew, ConcurrentMarkSweep Memory: 1981M Cores: 8 Non-Bundled Plugins: org.jetbrains.kotlin, com.suusan2go.kotlin-fill-class The project I’m working on: https://github.com/audioburst-labs/AudioburstMobileLibrary
I’d like to add that removing
.idea
folder, restarting IDE and
Invalidate Caches / Restart
doesn’t help
And it’s the same for any plugin I’m trying to apply
m
Are you using the Android plugin? It doesn't work well with mpp
k
Yes, I’m using and generally it works fine, I was using some Android-specific stuff in this project and I didn’t encounter any problems with it
I tried to comment-out all of the Android-specific stuff in my
build.gradle
file and it didn’t change anything
m
You need to remove the Android plugin from the classpath altogether unfortunately...
k
What if I want to keep working on it? I mean my project is multiplatform library, nothing fancy and it seems like such basic configuration is problematic, what should I do then?
I'm not super proud of it but we have very little Android code so at least the IDE is still working with the rest of the code
And when I want to touch the Android code well, it's all red everywhere
k
Thank you for your answer! I’m not totally sure how I should apply your advice in my project, but I will try to figure it out
👍 1
I need to ask another question unfortunately, because I’m not totally sure what do you mean by:
You need to remove the Android plugin from the classpath altogether unfortunately...
I tried to remove all of the occurrences of
Android
in the project, so I removed all entries form
build.gradle
regarding android (including
com.android.library
and
kotlin-android-extensions
plugins as well as Android’s source sets). I removed
build gradle plugin
declaration from
settings.gradle
file, I removed
#sdk.dir
path from
local.properties
, and I disabled
Android plugin
in IntelliJ and it still doesn’t work. Is there anything more you can think of I can do?
m
Damn it's something else then :-(
k
OK, thank you anyway! 🙂
m
Sorry that didn't work out 😕. What you can do in these cases is comment out Gradle plugins until you find the culprit
It's a long process but if you ever find the root cause or can do a reproducer project, file an issue, this is important for developer experience
(not related to the initial problem but I just saw you're using the bintray plugin. You certainly want to use
maven-publish
instead. It's a first-party plugin that plays better with Gradle metadata amongst other things, see https://github.com/bintray/gradle-bintray-plugin/issues/229)
k
No problem, I really appreciate your help 🙂 Sure I will try to find a root of the problem and if I can’t I will try to create a reproduce project (even though it can be reproduced in my public project, I think it would be good to shrink it down to better understand where the problem actually is). Thank you for suggestion, actually I already switched to
maven-publish
but problem arise again when I wanted to apply another plugin (
com.chromaticnoise.multiplatform-swiftpackage
). Because of that I was able to verify that
bintray
itself isn’t a root of the problem
m
In the video you linked, you didn't specifiy the bintray version, is that expected? Can you try with
id("com.maven.bintray").version("1.8.5")
?
k
It is the same
m
Double checking: does it build from the command line?
k
To my surprise it does not and it seems like it can’t find this dependency:
Copy code
* What went wrong:
Plugin [id: 'com.maven.bintray', version: '1.8.5'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.maven.bintray:com.maven.bintray.gradle.plugin:1.8.5')
  Searched in the following repositories:
    Gradle Central Plugin Repository
    Google
    BintrayJCenter
    MavenRepo
m
That might explain things, the IDE won't be able to build the Gradle model if it doesn't work from the command line in the first place
Looks like bintray does not expose a plugin marker 😒 (https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers)
One more reason to not use the bintray plugin...
If you really want to add it, you can add rules to the
pluginMangement{}
block of the
settings.gradle.kts
k
Once again - thank you so much for your time and help! I really appreciate it 🙂 I didn’t know about
pluginMangement{}
block purpose so next lesson learned today 🙂
m
Sure thing!