Android的工作室 - 无法指定自己的minSdkVersion [英] Android Studio - Can't specify own minSdkVersion

查看:180
本文介绍了Android的工作室 - 无法指定自己的minSdkVersion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装今天早些时候我想让既Android的L和较旧的版本,如糖豆我的应用程序兼容Android的大号开发preVIEW SDK之后。我的应用程序使用16的的minSdkVersion但因为我尝试了开发商preVIEW Android的工作室似乎不尊重我的minSdkVersion。我试图让我的应用程序在我的Galaxy Nexus的(API 19)运行,这里是我得到的错误:

下面是我的Andr​​oidManifest.xml

 < XML版本=1.0编码=UTF-8&GT?;

<舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    包=com.simon.holocountownapp
    安卓版code =45
    机器人:VERSIONNAME =4.1.1>

<用途-SDK
    安卓的minSdkVersion =16
    机器人:targetSdkVersion =L/>

...
 

下面是我的build.gradle:

 应用插件:'机器人'

安卓{
    compileSdkVersion机器人-L'
    buildToolsVersion'20'

    defaultConfig {
        的minSdkVersion 16
        targetSdkVersion'L'
    }
    buildTypes {
        推出 {
            runProguard真
            proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'ProGuard的-rules.txt
        }
    }
    productFlavors {
    }
}

依赖{
    编译com.doomonafireball.betterpickers:图书馆:1.5.2
    编译uk.co.androidalliance:edgeeffectoverride:1.0.1
    编译com.readystatesoftware.systembartint:systembartint:+
    编译com.android.support:support-v4:+
    编译com.android.support:support-v13:+
}
 

解决方案

您正在使用这种依赖关系:

 编译com.android.support:support-v4:+
 

在这种方式,您正在使用的支持-V4的L- preVIEW (21-RC1)。

这支持LIB正在申报的minSdkVersion→(您可以检查清单)。

您必须强制的minSdkVersion是L(检查文档:的 http://developer.android.com/$p$pview/setup-sdk.html

在开发环境中,打开build.gradle文件,你的模块,并确保:

  compileSdkVersion设置为机器人-L'
的minSdkVersion被设置为L
targetSdkVersion被设置为L
 

这是不是一个错误,但这是因为这些API不是最终的。它是一种以prevent安装应用程序的最终API 21设备上或使用支持LIB 21-R1上的商店发布了。

After installing the Android L Developer Preview SDK earlier today I wanted to make my app compatible with both Android L and older versions such as Jelly Bean. My app uses a minSdkVersion of 16 but since I tried out the developer preview Android Studio doesn't seem to respect my minSdkVersion. I'm trying to get my app to run on my Galaxy Nexus (API 19) and here's the error I get:

Here's my AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.simon.holocountownapp"
    android:versionCode="45"
    android:versionName="4.1.1" >

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="L" />

...

Here's my build.gradle:

apply plugin: 'android'

android {
    compileSdkVersion 'android-L'
    buildToolsVersion '20'

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 'L'
    }
    buildTypes {
        release {
            runProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile 'com.doomonafireball.betterpickers:library:1.5.2'
    compile 'uk.co.androidalliance:edgeeffectoverride:1.0.1'
    compile 'com.readystatesoftware.systembartint:systembartint:+'
    compile "com.android.support:support-v4:+"
    compile "com.android.support:support-v13:+"
}

解决方案

You are using this dependency:

compile "com.android.support:support-v4:+"

In this way you are using the support-v4 in L-preview (21-rc1).

This support lib is declaring minSdkVersion L (you can check the Manifest).

You have to force the minSdkVersion to be 'L' (check the doc: http://developer.android.com/preview/setup-sdk.html)

On the development environment, open the build.gradle file for your module and make sure that:

compileSdkVersion is set to 'android-L'
minSdkVersion is set to 'L'
targetSdkVersion is set to 'L'

It is not a bug, but this is because these APIs are not final. It is a way to prevent installing the apps on a final API 21 device or publishing it on the store using support lib 21-r1.

这篇关于Android的工作室 - 无法指定自己的minSdkVersion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆