[英]Facing Compatibility issue in android studio 3.0
我最近將android studio更新到了版本3.0,現在我面臨sdk兼容性問題,這意味着即使我在gradle中提到了“ minSdkVersion 15”,該應用也停止對低於21的sdk做出響應。 請有人告訴我如何解決此問題?
這是我的禮物
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.demo.msts"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:27.0.0'
compile('com.wdullaer:materialdatetimepicker:3.3.1')
{
exclude group: 'com.android.support'
}
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.0.0'
implementation 'com.android.support:support-v4:27.0.0'
implementation 'com.android.support:support-compat:27.0.0'
implementation 'com.android.support:support-core-ui:27.0.0'
implementation 'com.android.support:recyclerview-v7:27.0.0'
implementation 'com.android.support:cardview-v7:27.0.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.android.support:support-core-utils:27.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:2.2.2'
}
最后,我通過在“漸變依賴項”中包含以下行來解決此問題。
implementation 'com.android.support:multidex:1.0.2'
並在“ defaultConfig”中包含“ multiDexEnabled true”
defaultConfig {
...
multiDexEnabled true
}
在清單文件中,我在“ application”標記內包含以下屬性。
android:name="android.support.multidex.MultiDexApplication"
引用了這個https://developer.android.com/studio/build/multidex.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.