本文介绍了安装失败,因为应用的 minSdkVersion 比设备的 API 级别新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的 gradle 设置.

Here is my gradle settings.

ext {
    android_compile_version = 26
    android_version = '26.0.1'
    android_min_sdk_version =15

    appcompat_library_version = '25.2.0'
    support_library_version = '25.2.0'
    gms_library_version = '11.0.4'
}

这是在我的 project.gradle 文件和

this is define in my project.gradle file and

apply plugin: 'com.android.application'

android {

    compileSdkVersion android_compile_version
    buildToolsVersion android_version

defaultConfig {

    applicationId "com.xxasda.stickman"

    minSdkVersion android_min_sdk_version
    targetSdkVersion compileSdkVersion
    versionCode 2
    versionName "1.1"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}

dependencies {
    compile "com.android.support:appcompat-v7:${appcompat_library_version}"
    compile "com.android.support:support-v4:${support_library_version}"
    compile project(':libraries:BaseGameUtils')
}

buildscript {
    repositories {
        jcenter()
    }
}

这是我的 Build.Gradle 文件,我不知道为什么它不能编译.但是当我尝试在模拟器上运行应用程序时,它会抛出这个错误

This is my Build.Gradle file I don't know why it's not compiling.but when I try to run application on emulator it throws me this error

Failure [INSTALL_FAILED_OLDER_SDK]


Installation failed since app's minSdkVersion is newer than device's API level (API 23).
Please update your apps minSdkVersion.
Error while Installing APK

我检查了很多次并将 min_sdk_version 替换为绝对值 15 但仍然没有运气.请任何人建议它会有所帮助.

I checked many times and replace min_sdk_version with absolute value 15 but still no luck.any one please advice it would be helpful.

谢谢.:)

推荐答案

您可以尝试在您的 build.gradle (D:\AppName\app\build.gradle) 默认配置下添加以下行:

You can try to add to your build.gradle (D:\AppName\app\build.gradle) the following line under default config:

minSdkVersion 28 //or whatever version you need

    defaultConfig {
    applicationId "com.example.appname"
    minSdkVersion 28 <<<----------------------------------
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

这篇关于安装失败,因为应用的 minSdkVersion 比设备的 API 级别新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 17:11