I want to use productFlavors to build multi-versions of X2IMG.(Free & Pro)
So i want to remove the INTERNET and ACCESS_NETWORK_STATE permissions. and remove Google Admob AdActivity reference in Pro version config.
I find one solutions is use provided
provided 'com.google.android.gms:play-services-ads:8.4.0'
But from Android Gradle Plugin v1.1 provided dependencies can only be jars. and Android Library can’t use provided, but you can change your build configuration to 1.1.0.
http://stackoverflow.com/questions/28774667/provided-dependencies-can-only-be-jars
The Best solution: Use tools:node=”remove”
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="xxx">
<uses-permission android:name="android.permission.INTERNET" tools:node="remove" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" tools:node="remove" />
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" tools:node="remove" /> <meta-data android:name="com.google.android.gms.version android:value="@integer/google_play_services_version" tools:node="remove" />
This is the Official solutions guide: Manifest Merge – Marker Selectors
Other Tips:
By developing X2IMG v1.2.0, I have to move the project from Eclipse to Android Studio. During this week i had meeted some problems and finded the answers.
Share the helpful site pages:
Pl guide for use I am not to use.