android - 失败 [INSTALL_FAILED_OLDER_SDK] Android-L

标签 android android-5.0-lollipop

我正在尝试使用来自 Android L 的新 CardView。我更新了 SDK 管理器中的所有内容,但我不断收到以下错误:

Failure [INSTALL_FAILED_OLDER_SDK]

这是我的 build.gradle 文件:

apply plugin: 'android'

android {
    compileSdkVersion 'android-L'
    buildToolsVersion '20.0.0'

    defaultConfig {
        applicationId "www.thomascbeerten.com.nieuwetests"
        minSdkVersion 8
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    // Support Libraries
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.android.support:appcompat-v7:19.1.0'
    compile 'com.android.support:gridlayout-v7:19.1.0'
    compile 'com.android.support:mediarouter-v7:19.1.0'
    // compile 'com.android.support:support-v13:19.1.0'
    compile 'com.android.support:recyclerview-v7:+'
}

最佳答案

Recently there was a post here regarding the L SDK's incompatibility with prior versions of Android. I've been digging in AOSP repositories for quite a few hours now, and determined that the tools behave this way because they are designed to treat preview platforms differently. If you compile against a preview SDK (android-L), the build tools will lock minSdkVersion and targetSdkVersion to that same API level. This results in the produced application being unable to be installed on devices running older releases of Android, even if your application isn't doing anything specific to L. To make matters worse, the new support libs (CardView, RecyclerView, Palette, etc.) are also locked into the L API level, even though--according to their repository names--they should work on API level 7 just fine (and they do!).

请参阅我的 Reddit 帖子 here , 有一个解决方法。

关于android - 失败 [INSTALL_FAILED_OLDER_SDK] Android-L,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24457831/

相关文章:

android - 如何在一个应用程序中设置两个不同的启动器名称和图标 (android)

android - 升级到 Lollipop 后无法测试应用程序

android - 如果手机处于飞行模式或不在网络中,如何获取手机?

Android资源链接失败错误: failed linking references. Drawables

android - 项目目标(Android L(预览版))未正确加载

java - 在 Image View 上设置波纹效果

android - 在启用任务锁定的情况下启动另一个应用程序

android - 工具栏 - findViewbyID 返回 null

java - 如何知道 Activity 何时在 Fragment 中死亡

java - 每次我尝试运行时,应用程序都会强制关闭。需要帮助。