Swe*_*now 5 android android-manifest android-studio android-gradle-plugin android-5.0-lollipop
在今天早些时候安装Android L开发人员预览版SDK之后,我想让我的应用程序兼容Android L和旧版本,例如Jelly Bean.我的应用程序使用16的minSdkVersion但是因为我尝试了开发人员预览Android Studio似乎不尊重我的minSdkVersion.我正试图让我的应用程序在我的Galaxy Nexus(API 19)上运行,这是我得到的错误:
这是我的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" />
...
Run Code Online (Sandbox Code Playgroud)
这是我的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:+"
}
Run Code Online (Sandbox Code Playgroud)
您正在使用此依赖项:
compile "com.android.support:support-v4:+"
Run Code Online (Sandbox Code Playgroud)
通过这种方式,您可以在 L-preview (21-rc1) 中使用support-v4 。
该支持库正在声明minSdkVersion L
(您可以检查清单)。
您必须强制 minSdkVersion 为“L”(检查文档: http: //developer.android.com/preview/setup-sdk.html)
在开发环境中,打开模块的 build.gradle 文件并确保:
compileSdkVersion is set to 'android-L'
minSdkVersion is set to 'L'
targetSdkVersion is set to 'L'
Run Code Online (Sandbox Code Playgroud)
这不是一个错误,但这是因为这些 API 不是最终版本。这是一种防止在最终 API 21 设备上安装应用程序或使用支持库 21-r1 在商店上发布应用程序的方法。
归档时间: |
|
查看次数: |
2587 次 |
最近记录: |