1. 程式人生 > >Android官方入門文件[1]建立一個Android專案

Android官方入門文件[1]建立一個Android專案

app.app/build.gradle
Android Studio使用Gradle編譯和建立自己的應用程式。有對專案中的每個模組,以及用於整個專案build.gradle檔案build.gradle檔案。通常情況下,你只關心該模組的build.gradle檔案,在這種情況下,應用程式或應用程式模組。這是你的應用程式的構建依賴關係設定,包括defaultConfig設定:
•compiledSdkVersion是平臺版本對您將編譯您的應用程式。預設情況下,它被設定為Android系統的最新版本在你的SDK。 (這應該是Android 4.1或更高版本;如果沒有這樣一個版本,你必須使用SDK管理器中安裝一個。)你還可以建立自己的應用程式,以支援舊版本,但這種設定到最新版本,您可以要啟用新功能和優化的應用程式為最新裝置的使用者體驗。
•applicationID是您在新建專案工作流程中指定的應用程式的完全限定包名。
•minSdkVersion是你指定的最低SDK版本的新專案工作流程中。這是您的應用程式支援Android  SDK的最早版本。
•targetSdkVersion表示最高版本的Android與您已經測試您的應用程式。由於Android 新版本可用,您應該測試您的應用程式的新版本和更新此值,以匹配最新的API等級,從而採取新的平臺功能。欲瞭解更多資訊,請閱讀支援不同平臺版本。
Android Studio uses Gradle to compile and build your app. There is a build.gradle file for each module of your project, as well as a build.gradle file for the entire project. Usually, you're only interested in the build.gradle file for the module, in this case the app or application module. This is where your app's build dependencies are set, including the defaultConfig settings: •compiledSdkVersion is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK. (It should be Android 4.1 or greater; if you don't have such a version available, you must install one using the SDK Manager.) You can still build your app to support older versions, but setting this to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
•applicationId is the fully qualified package name for your application that you specified during the New Project workflow.
•minSdkVersion is the Minimum SDK version you specified during the New Project workflow. This is the earliest version of the Android SDK that your app supports.
•targetSdkVersion indicates the highest version of Android with which you have tested your application. As new versions of Android become available, you should test your app on the new version and update this value to match the latest API level and thereby take advantage of new platform features. For more information, read Supporting Different Platform Versions.