Just come into contact with the development of Android, to what are unfamiliar, this article is their own use in the project summary of technical points, the big coffee encounter can be directly floating over .....
1.Gradle packing (no nonsense to script directly), put the following script in the Build.gradle file android{};
1defaultconfig{2//ApplicationID ""//App Package Name3 Minsdkversion 9//SDK minimum supported version4 Targetsdkversion 17//SDK Target version5 Versioncode 16 Versionname "1.0"78//Dex Breakthrough 65535 Limit9 multidexenabledTrue1011//Androidmanifest.xml inside Umeng_channel's VALUE is ${umeng_channel_value}12//Manifestplaceholders = [Umeng_channel_value: ""]13}1415//Perform a lint check, have any errors or warning prompts, will terminate the build, we can turn it off.16lintoptions{AbortonerrorFalse18}1920//Signature21stsigningconfigs{22myconfig{StoreFile file ("123456")//Signature file pathStorepassword "123456"Keyalias "123456"Keypassword "123456"27}28}293031Buildtypes {32Release {33//Do not display logBuildconfigfield "Boolean", "Log_debug", "false"35//ConfuseApprox. minifyenabledTrue37//Zipalign optimizationZipalignenabledTrue39//Removing useless resource filesShrinkresourcesTrue41//Load default obfuscation profile Progudard-android.txt in the SDK directory, without the tube, proguard.cfg is our own confusing file with <span></span>Proguardfiles getdefaultproguardfile (' Proguard-android.txt '))Proguardfile ' Proguard.cfg '44//Signature45Signingconfig Signingconfigs.myconfig46}47}4849//Flavordimensions "Abi"5051//Channel flavors, I have written here some common52productflavors {53_360 {54}55Xiaomi {56}57}5859Productflavors.all {FlavorFlavor.manifestplaceholders =[Umeng_channel_value:name]62}6364Applicationvariants.all {variant--Variant.outputs.each {output-OutputFile def = Output.outputfile68 if (outputFile! = null && OutputFile.name.endsWith ('. apk ' 69 70 // output apk name is called Appname_v1.0.apk71 def fileName = "${variant.productflavors[0].name}_v${ defaultconfig.versionname}.apk "72 output.outputfile = new File (outputfile.parent, fileName) 73 }74 }75}
Then using the Gradle clean assemblerelease-d (output debug information) will generally be successful 360 and Xiaomi channel package.
Notes:
1. Confusing file issues
Proguard. Parseexception:unknown option ' Nobelium?--dump.txt
First look at the obfuscation profile encoding and then most change the file to Proguard.cfg, and open the view file in the command line to be recognized so far;
2. References to third-party jar issues
Execution failed for task Java.io.IOException:Can ' t write ' Can ' t read
See if a third-party jar package is referenced more than once (the jar has been referenced multiple times), referring to the wording of Maven dependency
dependencies { compile ‘com.android.support:support-v4:13.0.0‘ }
And the jar that follows can ' t read is deleted in Libs.
(use Gradle2.2.1 eclipse to move to Android Studio project)
Http://www.cnblogs.com/aland/p/4482825.html
Gradle use and error analysis for multichannel packaging (RPM)