NO1:
Build Variant = Build Type + Product Flavor
Build Variant: The product of construction
Build Type: Types of Builds
Product Flavor: The channels to build
android{ "23.0.1" productflavors{ google{} baidu{ }}
No2:
Flurry multi-channel and Friends Alliance multi-Channel construction
Flurry itself without the concept of channels, it has application, so can be a application as a channel, each application has a key, called the flurry Key, the friends of the Union itself has the concept of channels, As long as we configure annotations in Androidmanifest.xml.
android{compilesdkversion atbuildtoolsversion"23.0.1"defaultconfig{ApplicationID"org.flysnow.app.example112"minsdkversion -targetsdkversion atVersioncode1Versionname'1.0.0'Resconfig'ZH'} buildtypes{release{minifyenabledtrueprojuardfiles Getdefaultproguardfile ('Proguard-android.txt'),'Proguard-rules.pro'zipalignenabledtrue}} productflavors{google{Buildconfigfield'String','Flurry_key','"Bhjkouasdasfklzl"'} baidu{Buildconfigfield'String','Flurry_key','"HJSDKHFJDSF23478"' } }}
This will have the name Flurry_key constant defined for each channel in the Buildconfig class.
The Friend Alliance Channel is configured in the Androidmanifest.xml
<meta-data android:value="Channel ID" android:name="umeng_ CHANNEL"/>
Where channel ID is the funnel value
No3:
Multi-channel build customization-in fact, the Productflavor configuration of Android Gradle plug-ins, configure Productflavor to flexibly control the purpose of each channel
ApplicationID is the package name of the channel.
android{... productflavors{ google{ "org.flysnow.app.example112.google" } }}
consumerproguardfiles--is only useful for Android library projects
android{ productflavors{ google{ 'proguard-rules.pro',' proguard-android.txt'}} }
testapplicationid--Test Package Name
android{... productflavors{ google{ "org.flysnow.app.example112.test" } }}
Whether testfunctionaltest--is a functional test, testhandleprofiling--whether the profiling feature is enabled
android{ productflavors{ google{ true} }}
testinstrumentationrunner--used to configure the class name of the instrumentation runner used to run the test
android{ productflavors{ google{ ' Android.test.InstrumentationTestRunner'}} }
testinstrumentationrunnerarguments--used to configure the parameters used by the instrumentation runner
android{ productflavors{ google{ testinstrumentationrunnerarguments.put (" Coverage",'true') }}}
usejack--is used to mark whether Jack and Jill are enabled this new, high-performance compiler
android{ productflavors{ google{ true }} }
Dimension-multidimensional degrees, understood as grouping Prodcutflavor. Use Flavordimensions to declare a dimension in order to be used in Productflavor
android{flavordimensions"Abi","version"//Priority: Abi>version>defaultconfigproductflavors{free{Dimension'version'} paid{Dimension'version'} x86{Dimension'Abi'} arm{Dimension'Abi' } }}
is generated
Armfreedebug
Armfreerelease
Armpaiddebug
Armpaidrelease
X86freedebug
X86freerelease
X86paiddebug
X86paidrelease
No4:
Improve the efficiency of multi-channel builds-US mission plan
1) Use Android Gradle to play a basic package
2) Copy one based on the package, the file name should be able to distinguish the product, packaging time, version, channel, etc.
3) To modify the copied apk file, in its Meta-inf directory to add empty files, but the file name of empty files to make sense, must contain the name of the channel can be distinguished, such as: Mtchannel_google
4) Repeat step 2) Step 3 generate all of the channel packs we need apk, which can be done using Python scripts like this
5) APK package for all our release channels
Use:
At the time of apk boot (application onCreate), read the prefix mtchannel_ file that we wrote in the Meta-inf directory in the APK, if found, take out the file name, and then we can get the Channel logo (Google)
"Gradle authoritative guide"--android gradle multi-channel construction