applicationId is set to 'com.super.app' in default config

转载:http://stackoverflow.com/questions/27374933/android-studio-1-0-and-error-library-projects-cannot-set-applicationid

错误信息:

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'
       }
   }

你可能感兴趣的:(library)