转载请标明出处:http://blog.csdn.net/xx326664162/article/details/50160097 文章出自:薛瑄的博客
你也可以查看我的其他同类文章,也会让你有一定的收货!
错误信息:
Error: Library projects cannot set applicationId. applicationId is set to ‘com.super.app’ in default config.
代码示例:
defaultConfig {
applicationId "com.super.app" <---- remove this line
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
不能使用applicationId 去定制包名在lib module中,在lib module中必须是固定的,可以在manifest中指定包名,
有两种解决办法:
一、 去除applicationId “com.super.app” 代码,在defaultConfig 节点中。
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
并在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'
}
}
关注我的公众号,轻松了解和学习更多技术