简体   繁体   中英

Facing Compatibility issue in android studio 3.0

I recently updated android studio to version 3.0 and now i am facing sdk compatibility issue means the app stops responding on sdk below 21 even after mentioning "minSdkVersion 15" in my gradle. Please someone tell me how can I fix this issue?

Here is my 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'
}

Finally, I Solved this problem by including following line in "gradle dependencies".

implementation 'com.android.support:multidex:1.0.2'

and including "multiDexEnabled true" inside "defaultConfig"

defaultConfig {
...
multiDexEnabled true
}

And in the manifest file I include below attribute inside "application" tag.

android:name="android.support.multidex.MultiDexApplication"

refered this https://developer.android.com/studio/build/multidex.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM