Gradle with Android

Gradle with Android

  The Android Studio build system is based on Gradle, and the Android plugin for Gradle adds several features that are specific to building Android apps.

  

1、Update the Android Plugin for Gradle

  You can specify the Android plugin for Gradle version in either the File > Project Structure > Project menu in Android Studio, or the top-levelbuild.gradle file. The plugin version applies to all modules built in that Android Studio project. The following example sets the Android plugin for Gradle to version 2.2.3 from the build.gradle file:

  

  If the specified plugin version has not been downloaded, Gradle downloads it the next time you build your project or click Tools > Android > Sync Project with Gradle Files from the Android Studio menu bar.

2、Set the Application ID

  Every Android app has a unique application ID that looks like a Java package name, such ascom.example.myapp. This ID uniquely identifies your app on the device and in Google Play Store. If you want to upload a new version of your app, the application ID (and the certificate you sign it with) must be the same as the original APK—if you change the application ID, Google Play Store treats the APK as a completely different app. So once you publish your app, you should never change the application ID.

  参考:https://developer.android.com/studio/build/application-id.html#change_the_application_id_for_testing

3、Build System

  参考:http://android.xsoftlab.net/tools/building/multidex.html

原文地址:https://www.cnblogs.com/tekkaman/p/6346635.html