(when adding jar) - Module “android” must not contain source root

前端 未结 8 1804
忘掉有多难
忘掉有多难 2020-12-24 13:18

I\'m trying to add gdx-tools.jar to a libGDX project in IntelliJ. The result:

Module \"android\" must not contain source root \".../android/src\". The

相关标签:
8条回答
  • 2020-12-24 13:59

    simple 'delete my_project.iml file and import project once again using File->New->Project From Existing Sources'

    0 讨论(0)
  • 2020-12-24 14:05

    I had run into a similar issue as well:

    Module "(my_project)" must not contain source root "(my project)/src". The root already belongs to module "(my_project)".

    As I couldn't do anything on IDEA's configuration UI, I opened up the IDEA project file (my_project.iml) in vi, hoping to find out what's wrong:

    <sourceFolder url="file://$MODULE_DIR$/my_project/src" type="java-resource" />
    <sourceFolder url="file://$MODULE_DIR$/my_project/src" isTestSource="false" />
    <!-- Duplicate entry found in project file -->
    

    So eventually I solved my case by removing the duplicate entry manually.

    As the IDEA project files were generated automatically from Gradle files, I have no idea what caused the duplicate entries to be created, but for those facing similar issues, a quick glance at the .iml file may help.

    0 讨论(0)
提交回复
热议问题