【问题标题】:Android studio : Installation did not succeed. The application could not be installed: INSTALL_FAILED_OLDER_SDK [duplicate]Android studio : 安装没有成功。无法安装应用程序:INSTALL_FAILED_OLDER_SDK [重复]
【发布时间】:2021-01-20 06:37:26
【问题描述】:

我通过添加第二个活动对我的代码进行了修改,现在我遇到了这个错误:

01/20 07:14:24: Launching 'app' on 10.1  WXGA (Tablet) API 26.
    Installation did not succeed. The application could not be installed:
    INSTALL_FAILED_OLDER_SDK
    List of apks: [0]
    'C:\Users\Moi\Desktop\EscapeGameSTW\app\build\outputs\apk\debug\app-debug.apk'
    The application's minSdkVersion is newer than the device API level.

AndroidiManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication">

    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <uses-feature android:name="android.hardware.type.watch" />



    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.NoActionBar">
        <uses-library
            android:name="com.google.android.wearable"
            android:required="true" />

        <!--
               Set to true if your app is Standalone, that is, it does not require the handheld
               app to run.
        -->
        <meta-data
            android:name="com.google.android.wearable.standalone"
            android:value="true" />

        <activity
            android:name=".MainActivity"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

build.gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 27
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.navigation:navigation-fragment:2.3.1'
    implementation 'androidx.navigation:navigation-ui:2.3.1'
    implementation 'androidx.wear:wear:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    compileOnly 'com.google.android.wearable:wearable:2.5.0'

}

我要使用的deviceSDK是API26。

我已经删除了修改,但错误仍然存​​在。 我试图将 compileSdkVersion 更改为 26 我怎样才能恢复这个错误?

谢谢大家。

【问题讨论】:

  • 请注意,我通过下载更新版本的 SDK 解决了这个问题。只需转到Tools->SDK Manager 并下载更新的版本。没有找到有用的链接答案。

标签: java android


【解决方案1】:

我发现了我的问题。这是由于图书馆可穿戴设备。删除后一切正常

<uses-library
        android:name="com.google.android.wearable"
        android:required="true" />

最大

【讨论】:

    【解决方案2】:

    您的手机API level低于您项目的最低SDK版本

    在gradle中:

    defaultConfig {
        applicationId "com.example.myapplication"
        //You have to decrease the minSdkVersion cause, your android's API level is lower than this. minSdkVersion used for from which API level of android you can use
        minSdkVersion 27
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
    
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    

    所以,试试

    minSdkVersion 20
    

    如果可能的话,它还必须与您的源代码兼容。只需根据您的 android 的 API 级别更改它

    【讨论】:

      最近更新 更多