系统SDK版本,系统版本设置太高,但是编译器版本较低。
下面的26是你看编译器什么版本的sdk,我编辑环境设置的sdk是30,配置是按照下面的配置的
编译器是26,更改匹配完成就可以了
apply plugin: 'com.android.application'
android {
compileSdkVersion 26 //30改为26
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.helloworld"
minSdkVersion 26
targetSdkVersion 26 //30改为26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.+' //30改为26
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
附件:常见sdk和安卓版本对应关系
|Android 8.0 26 Oreo
Android 7.1 25 Nougat
Android 7.0 24 Nougat
Android 6.0 23 Marshmallow
Android 5.1 22 Lollipop //minSdkVersion 22
Android 5.0 21 Lollipop
Android 4.4 19 KITKAT //minSdkVersion 19
Android 4.3 18 JELLY_BEAN_MR2
Android 4.2, 4.2.2 17 JELLY_BEAN_MR1
Android 4.1, 4.1.1 16 JELLY_BEAN
Android 4.0.3, 4.0.4 15 ICE_CREAM_SANDWICH_MR1
Android 4.0, 4.0.1, 4.0.2 14 ICE_CREAM_SANDWICH
Android 3.2 13 HONEYCOMB_MR2
Android 3.1.x 12 HONEYCOMB_MR1
Android 3.0.x 11 HONEYCOMB
Android 2.3.4 10 GINGERBREAD_MR1
Android 2.3.3 10 GINGERBREAD_MR1
Android 2.3.2 9 GINGERBREAD
Android 2.3.1 9 GINGERBREAD
Android 2.3 9 GINGERBREAD
Android 2.2.x 8 FROYO
Android 2.1.x 7 ECLAIR_MR1
Android 2.0.1 6 ECLAIR_0_1
Android 2.0 5 ECLAIR
Android 1.6 4 DONUT
Android 1.5 3 CUPCAKE
Android 1.1 2 BASE_1_1
Android 1.0 1 BASE