为SDK21 android应用程序编译

为SDK21 android应用程序编译,android,sdk,Android,Sdk,我的应用程序在targetSdkversion=25和compileSdkversion=25时运行良好 现在我需要让它在targetSdkversion as 21上工作。应用程序失败,出现错误应用程序已停止工作 我是否需要更改任何工具版本或任何其他参数 apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion '26.0.2' useLibrary 'org.apache

我的应用程序在targetSdkversion=25和compileSdkversion=25时运行良好

现在我需要让它在targetSdkversion as 21上工作。应用程序失败,出现错误应用程序已停止工作

我是否需要更改任何工具版本或任何其他参数

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'

}

请分享您收到的错误日志,因为如链接中所述,您应该根据应用程序所能支持的平台的最低版本编译应用程序。

希望这能有所帮助:@Sara谢谢你,但读完这篇文章后,我发现自己更加困惑了。这是否意味着targetversion与我的问题无关?