- sourceSets {
- main {
- if (!isNeedUserModule.toBoolean()) {
- manifest.srcFile 'src/main/app/AndroidManifest.xml'
- } else {
- manifest.srcFile 'src/main/module/AndroidManifest.xml'
- }
- }
- }
- isNeedUserModule=true
- #isNeedUserModule=false
- if (!isNeedUserModule.toBoolean()) {
- apply plugin: 'com.android.application'
- } else {
- apply plugin: 'com.android.library'
- }
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.finddreams.module_user">
- <application>
- <activity
- android:name=".LoginActivity"
- android:label="@string/app_name"
- android:theme="@style/AppTheme">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- </manifest>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.finddreams.module_user" >
- <application>
- <activity android:name=".LoginActivity"></activity>
- </application>
- </manifest>
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- if (isNeedUserModule.toBoolean()) {
- compile project(':module_user')
- }
来源: http://blog.csdn.net/finddreams/article/details/78354209