collinsmith/riiablo

IntelliJ :android facet not detecting

Closed this issue · 0 comments

When importing the project into IntelliJ, project(':android') is not being detected as an android project with android-gradle facet applied. This causes an issue where I cannot run the project using an android run configuration as module is locked to <no module>. Simply trying to add this facet manually via Open Module Settings > Facets > Add results in an error message Content root "..\riiablo\assets" is defined for modules "riiablo.android" and "riiablo.core". Two modules in a project cannot share the same content root

I think this is caused by project(':core') build.gradle setting idea.module.resourceDirs += rootProject.file('assets') and project(':android;) build.gradle setting android.sourceSets.main.assets.srcDirs = ['../assets']. This is something happening since the gradle migration -- since before then all projects used the android assets dir. Need to look into a few different libgdx projects to see if this is the same behavior and into the intellij gradle plugin documentation for a possible long-term fix.

Workaround for this issue is to comment out the android assets.srcDirs line and add the facet and then uncomment the line afterwards. The run config seemed to work after this to install the app, but this doesn't stick through restarts and seems to break again and removes itself.

Additionally, building via gradlew android:assembleDebug works to generate an APK which can be copied to the device, but it's a pain when developing to keep having to copy over an APK manually and install it. This issue seems to be specific to having the project function properly with the IntelliJ android run configurations. - Everything else works fine.