-1

My app works fine with targetSdkversion = 25 and compileSdkversion = 25

Now I need to make it work for targetSdkversion as 21. The app is failing with an error app stopped working.

Do I need to change any tool version or any other parameters?

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
    applicationId "MY.APP.NAME"
    minSdkVersion 17
    targetSdkVersion 21
    versionCode 11
    versionName "1.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.google.code.findbugs'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.android.support:design:25.3.1'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
testCompile 'junit:junit:4.12'

}

Sriram Nadiminti
  • 107
  • 2
  • 12
  • hope this helps: https://stackoverflow.com/questions/26694108/what-is-the-difference-between-compilesdkversion-and-targetsdkversion – Sara Tirmizi Nov 16 '17 at 04:40
  • @Sara Thank you but after reading this I find myself more confused. Does that mean, targetversion has nothing to do with my problem? – Sriram Nadiminti Nov 16 '17 at 06:05

1 Answers1

1

Please share the error log you are getting , because as stated in the link, you should compile your application against the lowest possible version of the platform that your application can support. Should compile sdk be lower than target sdk

Sara Tirmizi
  • 417
  • 4
  • 10