面对android studio 3.0中的兼容性问题

时间:2017-10-28 09:35:12

标签: android android-studio-3.0

我最近将android studio更新到版本3.0,现在我面临sdk兼容性问题意味着即使在提及" minSdkVersion 15"之后,应用程序也停止响应21以下的sdk。在我的gradle中。请有人告诉我如何解决这个问题?

这是我的gradle

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'
}

1 个答案:

答案 0 :(得分:0)

最后,我通过在“gradle依赖项”中包含以下行解决了这个问题。

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