在更新Android L的工具后,构建失败了。

17

更新工具后,我无法构建我的项目。在Android Studio中,我遇到了以下错误:

/build/exploded-aar/com.android.support/support-v4/21.0.0-rc1/AndroidManifest.xml:3] 解析失败:必须是整数或代码名称。

有什么想法吗?

我认为这个清单来自支持库。我还有另一个针对我的项目的清单,它是min=14 target=19

<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="android.support.v4" >

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

    <application />

</manifest>

Gradle类路径 'com.android.tools.build:gradle:0.9.+'


如果minSdk=targetSdk,则它只能在最新的操作系统上运行。这将在明年秋季发布。 - Phantômaxx
3个回答

25
在您的app/build.gradle文件中,将
compile 'com.android.support:support-v4:+'
改为
compile 'com.android.support:support-v4:19.1.0'

'+'表示它将查找依赖关系的最新版本。 如果您下载了L预览版,则最新版本将是用于L的支持库-这对于目标为API 19的项目不起作用。

2
显式版本号的原因是什么? - bright-star
1
默认情况下,它将使用最新版本...即当前的L版本。 - Tobrun
2
请注意,非 Android-L 版本的最新版 Android 支持库是 20.0.0,因此,请尝试使用以下代码行:compile 'com.android.support:support-v4:20.+' - Xiao Liang
我有多个且相互依赖的模块,最终解析到版本号为21.0.0-rc1,即使我对某些模块应用了更改。是否有一种全局覆盖整个Android应用程序的方法? - kotucz
5
同样的,如果你正在使用它,你需要用compile 'com.android.support:appcompat-v7:19.1.0'替换compile 'com.android.support:appcompat-v7:+',原因相同。 - Mark Whitaker

2
你是否更新了build.gradle文件以反映这些更改?
compileSdkVersion is set to 'android-L'
minSdkVersion is set to 'L'
targetSdkVersion is set to 'L'

来源:http://developer.android.com/preview/setup-sdk.html

Android SDK是一组开发工具,可用于构建应用程序和操作系统。在此处,您可以下载最新版本的Android SDK并安装Android模拟器。Android SDK包括以下内容:
  • Android平台
  • SDK工具
  • 每个平台版本的API文档
  • 样本代码和教程
使用Android Studio时,它将自动安装最新版本的Android SDK。如果您正在使用其他IDE或命令行,则需要手动安装。您可以通过下载并解压缩SDK来安装,也可以使用SDK管理器进行安装。


不需要,我的项目最小版本是14,目标版本是19。至少现在我不需要L。另外,我正在使用Gradle 0.9.+。 - Bri6ko

1

这对我解决了问题,我能够构建应用程序。

compile('com.android.support:support-v4:19.1.0'){
    force = true
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接