Android Studio 1.0 and error "Library projects cannot set applicationId"
After updating Android Studio to 1.0, I see this error:
Error: Library projects cannot set applicationId. applicationId is set to 'com.super.app' in default config.
I updated the Gradle plugin as suggested but I did not understand how to fix this.
Solution 1:
Based on this info:
ApplicationId in Library Projects
You cannot use applicationId to customize the package of a library project. The package name has to be fixed in library projects (and specified as packageName in the manifest). The Gradle plugin did not enforce this restriction earlier.
Removing applicationId variable from the library's build.gradle
file should resolve the issue.
Solution 2:
Thanks to Joel for his correct answer: I need to remove only 1 line from te .gradle
file:
defaultConfig {
applicationId "com.super.app" <---- remove this line
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
becomes
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
and my AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.super.app">
...
This is the right solution if you don't need to rename the package name of your app. To rename it you need to use "flavours":
android {
...
productFlavors {
flavor1 {
applicationId 'com.super.superapp'
}
}