Android的摇篮设置 [英] Android Gradle settings

查看:163
本文介绍了Android的摇篮设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑的gradle与版本设置。我发现一些信息的有关此版本的系统,但无处被写了关于版本的详细信息。你能解释一下这些选项的意思吗?

  compileSdkVersion
buildToolsVersion
的minSdkVersion
targetSdkVersion

的minSdkVersion 是最明显的,因为这意味着我们要支持,例如最小的API 14(的Andr​​oid> = 4.0)。

targetSdkVersion


  

该属性通知你已经对目标版本和系统测试,不应该让任何兼容的行为,以保持与目标版本的应用程序的向前兼容系统。


我不明白这一点。

我的情况是支持从15 API的设备哪些是正确的设置?
结果
我读的地方,目标应该是最高的越好,Android的工作室告诉我,太,但是当我设置此,并尝试在Nexus 5上运行,我得到:

 失败[INSTALL_FAILED_OLDER_SDK]


我的的build.gradle

 安卓{
    compileSdkVersionAndroid的L'
    buildToolsVersion20.0.0    defaultConfig {
        的applicationIDmy.package.name
        14的minSdkVersion
        targetSdkVersion'L'
        版本code 1
        的versionName1.0
    }
    buildTypes {
        发布 {
            runProguard假
            proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
        }
    }
}


解决方案

根据官方文档:
http://developer.android.com/$p$pview/setup -sdk.html#的createProject
如果您想尝试新的功能,你应该使用这些值:

  compileSdkVersion设置为Android的L'
的minSdkVersion设置为L
targetSdkVersion设置为L

这是失败的原因[INSTALL_FAILED_OLDER_SDK]

如果你不需要的android-L,我建议使用这些值:

  defaultConfig {
        的applicationIDmy.package.name
        14的minSdkVersion
        targetSdkVersion 19
        版本code 1
        的versionName1.0
    }

据说,这里描述的一个非官方的解决方法(在任何情况下,我建议你不要使用它)

<一个href=\"http://stackoverflow.com/questions/24457831/failure-install-failed-older-sdk-android-l\">Failure [INSTALL_FAILED_OLDER_SDK]的Andr​​oid-L

I'm very confused with gradle versioning settings. I found some information about this build system, but nowhere was written about versioning details. Can you explain what these options mean?

compileSdkVersion
buildToolsVersion
minSdkVersion
targetSdkVersion

The minSdkVersion is most obvious, because it means the minimal API we want to support, e.g. 14 (Android >= 4.0).

The targetSdkVersion:

This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version.

I don't quite understand that.

My case is to support devices from API 15. What are the proper settings for that?
I read somewhere that target should be the highest as possible, Android Studio tells me that too, but when I set this up and try to run on Nexus 5 I get:

Failure [INSTALL_FAILED_OLDER_SDK]


My build.gradle

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

    defaultConfig {
        applicationId "my.package.name"
        minSdkVersion 14
        targetSdkVersion 'L'
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

解决方案

According to official doc: http://developer.android.com/preview/setup-sdk.html#createProject if you would like to try out new features you should use these values:

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

It is the reason of Failure [INSTALL_FAILED_OLDER_SDK].

If you don't need android-L I suggest using these values:

defaultConfig {
        applicationId "my.package.name"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }

Said that, there is an unofficial workaround described here (in any case I suggest that you don't use it)

Failure [INSTALL_FAILED_OLDER_SDK] Android-L

这篇关于Android的摇篮设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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