Build failed after updating tools for Android L

2019-03-17 22:06发布

I cannot build my project after updating the tools. I get this error in Android Studio.

/build/exploded-aar/com.android.support/support-v4/21.0.0-rc1/AndroidManifest.xml:3] Failed to parse : must be an integer number or codename.

Any ideas?

This manifest is from the support library I think. I also have another for my project which is 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 classpath 'com.android.tools.build:gradle:0.9.+'

3条回答
爷、活的狠高调
2楼-- · 2019-03-17 22:45

In your app/build.gradle file, change
compile 'com.android.support:support-v4:+'
to
compile 'com.android.support:support-v4:19.1.0'

The '+' means that it will look for the newest version of the dependency. If you download the L preview, the latest version will be the support library for L - which isn't going to work for a project whose target is API 19.

查看更多
欢心
3楼-- · 2019-03-17 22:45

This solved the issue for me and I was able to build the app.

compile('com.android.support:support-v4:19.1.0'){
    force = true
}
查看更多
混吃等死
4楼-- · 2019-03-17 22:48

Did you update your build.gradle file to reflect these changes?

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

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

查看更多
登录 后发表回答