1 //引入插件 2 apply plugin: 'com.android.application' 3 4 android { 5 compileSdkVersion 29 6 buildToolsVersion "29.0.0" 7 defaultConfig { 8 applicationId "com.example.myapplication" 9 minSdkVersion 28 10 targetSdkVersion 29 11 versionCode 1 12 versionName "1.0" 13 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 } 15 buildTypes { 16 release { 17 minifyEnabled false 18 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 } 20 } 21 } 22 23 dependencies { 24 //implementation定义项目主源代码的依赖 25 26 //配置依赖libs目录下的所有jar包 27 implementation fileTree(dir: 'libs', include: ['*.jar']) 28 //配置从中央仓库下载依赖jar包 29 implementation 'androidx.appcompat:appcompat:1.0.2' 30 implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 31 //testImplementation定义项目测试代码(test目录下的代码)的依赖 32 testImplementation 'junit:junit:4.12' 33 //androidTestImplementation定义androidTest目录下的代码依赖 34 androidTestImplementation 'androidx.test:runner:1.2.0' 35 androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 36 }