【问题标题】:compile for SDK21 android app为 SDK21 android 应用程序编译
【发布时间】:2017-11-16 04:32:49
【问题描述】:

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

现在我需要让它在 targetSdkversion 为 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'

}

【问题讨论】:

  • 希望对您有所帮助:stackoverflow.com/questions/26694108/…
  • @Sara 谢谢你,但在读完这篇文章后,我发现自己更加困惑了。是不是说,targetversion和我的问题无关?

标签: android sdk


【解决方案1】:

请分享您收到的错误日志,因为如链接中所述,您应该针对您的应用程序可以支持的最低版本平台编译您的应用程序。 Should compile sdk be lower than target sdk

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-19
    • 2018-06-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多