首页 > 解决方案 > 如何在我的 android 应用程序中添加对 android 4.4 的支持

问题描述

我正在开发一个应用程序,我还需要在 android 4.4 等旧版本的 android 中运行。我搜索了很多,但我仍然感到困惑,我尝试了多索引之类的方法,但没有奏效。我的模块文件如下所示:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "al.sqmo"
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.google.code.gson:gson:2.6.1'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
}

任何帮助表示赞赏!

标签: javaandroid

解决方案


在gradle中设置这个版本如下

minSdkVersion 19

这将允许在 kitkat 中运行应用程序。

让我知道更多帮助


推荐阅读