i have application has several product flavors, each own applicationid, , each flavor needs own androidmanifest.xml. these product flavors have library dependency. library's package name conflicting flavor's package name during manifest merge, can't seem work out combination of arrangements make work.
this manifest library:
<manifest package="com.mylibrary"> </manifest>
this manifest productflavor:
<tools:manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <uses-permission android:name="com.flavor1.permission.c2d_message" /> <permission android:name="com.flavor1.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="com.flavor1.maps_receive"/> <permission android:name="com.flavor1.permission.maps_receive" android:protectionlevel="signature"/> <application android:vmsafemode="true" android:name="com.mylibrary.application" android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name="com.mymainapp.mainactivity" tools:node="remove"/> <activity android:name="com.flavor1.mainactivity" android:screenorientation="portrait" android:windowsoftinputmode="adjustpan"> <intent-filter> <action android:name="android.intent.action.search"/> <action android:name="android.intent.action.main" /> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default"/> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </tools:manifest>
and base app's gradle:
apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.2" defaultconfig { applicationid 'com.myapp' minsdkversion 21 targetsdkversion 23 versioncode 409 versionname "v4alpha9" multidexenabled true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig signingconfigs.release } } databinding { enabled true } sourcesets { main { manifest.srcfile 'src/main/androidmanifest.xml' res.srcdirs = ['src/main/res'] java.srcdirs = ['src/main/java'] } flavor1 { res.srcdirs = ['src/productflavors/flavor1/res'] java.srcdirs = ['src/productflavors/flavor1/java'] manifest.srcfile 'src/productflavors/flavor1/androidmanifest.xml' } flavor2 { res.srcdirs = ['src/productflavors/flavor2/res'] java.srcdirs = ['src/productflavors/flavor2/java'] } } productflavors { flavor1 { applicationid 'com.flavor1' } flavor2 { applicationid 'com.flavor2' } } } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') testcompile 'junit:junit:4.12' compile project(':mylibrary') compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.google.code.gson:gson:2.4' compile 'com.mindscapehq.android:raygun4android:2.1.0' compile 'com.android.support:support-v4:23.4.0' }
and error is:
error:execution failed task ':myapp:processflavor1debugmanifest'. manifest merger failed : attribute tools:manifest@package value=(com.flavor1) (unknown) present @ [android:mylibrary:unspecified] androidmanifest.xml:3:5-44 value=(com.mylibrary). attributes of elements not merged.
Comments
Post a Comment