问题
I've upgraded the gradle build tools from 1.2.3 to 1.3.1 and started seeing the following error on gradle sync. I had no issues with 1.2.3 version. I'm on gradleVersion 2.3. Is there anyway I can avoid this error?
Error:Your project contains 2 or more modules with the same identification com.salesforce.android:AndroidCommon at ":AndroidCommon" and ":AndroidCommon:AndroidCommon". You must use different identification (either name or group) for each modules.
AndroidCommon is one of the libraries that I'm using. I tried with versions 1.3 and 1.4 of Android Studio. Seems like the AS version doesn't matter.
回答1:
This kind of error happens in these cases:
- 2 modules have the same identification (group+name). Check the code
- 1 module has the same name of the root project
In the first case:
- rename one of the modules
- update the
settings.gradle
file with the new name - run
gradlew clean assemble
In the second case.
- rename the root project or follow the steps above.`
This check was introduced with gradle-plugin 1.3.x. You can check the code:
- gradle plugin 1.3.1
- gradle plugin 1.2.3
回答2:
You have 2 modules with the same name as the error states change name of module.
To rename a module
go to settings.gradle and rename the module to your new name. Then close Android Studio, and rename the folder using File Explorer. Now reopen Android studio and your module name will be updated.
来源:https://stackoverflow.com/questions/33530050/upgrade-issue-in-gradle-build-tools-version-from-1-2-3-to-1-3-1