plugins { id 'com.android.application' } android { // 指定编译用的SDK版本号。比如31表示使用Android 12编译 compileSdk 31 defaultConfig { // 指定该模块的应用编号,也就是App的包名 applicationId "com.example.chapter02" // 指定App适合运行的最小SDK版本号。比如21表示至少要在Android 5.0上运行 minSdk 21 // 指定目标设备的SDK版本号。表示App最希望在哪个版本的Android上运行 targetSdk 31 // 指定App的应用版本号 versionCode 1 // 指定App的应用版本名称 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } // 指定App编译的依赖信息 dependencies { // 指定引用jar包的路径 implementation fileTree(dir: 'libs', include: ['*.jar']) // 指定编译Android的高版本支持库。如AppCompatActivity必须指定编译appcompat库 //appcompat库各版本见 https://mvnrepository.com/artifact/androidx.appcompat/appcompat implementation 'androidx.appcompat:appcompat:1.3.1' // 指定单元测试编译用的junit版本号 testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' }