(when adding jar) - Module “android” must not cont

2019-02-02 03:27发布

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 root already belongs to module "android".

This is what I've tried:

project structure > libraries > new project library > java > select "gdx-tools.jar" >select module "desktop"

project structure > modules > select "desktop" > new > jars or directories > select "gdx-tools.jar" >

Ideas?

7条回答
我命由我不由天
2楼-- · 2019-02-02 03:59

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

查看更多
时光不老,我们不散
3楼-- · 2019-02-02 04:00

I solve in with
Deletion both gen and gen [generated] from Source Folder.

enter image description here

查看更多
倾城 Initia
4楼-- · 2019-02-02 04:02

I solved the problem by simply renaming the project. Right click on the project, then click refactor.

查看更多
劳资没心,怎么记你
5楼-- · 2019-02-02 04:03

Just by going to the Artifacts Settings, Modules, Sources tab, and you will see 2 folders called "gen" and "gen[generated]", delete "gen" by clicking on the X icon to the right of it.

look: enter image description here

查看更多
Explosion°爆炸
6楼-- · 2019-02-02 04:08

I had same problem. Solved it by completely deleting project, then clone it back from GIT.

查看更多
The star\"
7楼-- · 2019-02-02 04:19

I fixed the issue by deleting .iml files of modules causing the issue.

查看更多
登录 后发表回答