in Android-6ren"> in Android-我正在使用 Android Studio 1.0.2,其中我有以下 build.gradle。 buildscript { repositories { jcenter() -6ren">
gpt4 book ai didi

android - 这是什么意思 in Android

转载 作者:太空宇宙 更新时间:2023-11-03 10:19:14 25 4
gpt4 key购买 nike

我正在使用 Android Studio 1.0.2,其中我有以下 build.gradle。

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

如果我不在 AndroidManifest.xml 中写这个,Android Studio 会给我一个错误.

<uses-sdk tools:overrideLibrary="com.google.android.gms" />

早于最新版本的 Android Studio。我必须写这个

<uses-sdk tools:node="replace" />

这到底是什么 <uses-sdk tools:node="replace" /><uses-sdk tools:overrideLibrary="com.google.android.gms" /> .

最佳答案

根据 http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger

tools:overrideLibrary marker

A special marker that can only be used with uses-sdk declaration to override importing a library which minimum SDK version is more recent than that application's minimum SDK version.Without such a marker, the manifest merger will fail. The marker will allow users to select which libraries can be imported ignoring the minimum SDK version.

并根据http://www.reddit.com/r/androiddev/comments/297xli/howto_use_the_v21_support_libs_on_older_ve

Version 0.11 of the Android Gradle Plugin turned on a new Manifest Merger by default, and it allows us to do some nifty stuff (read more about it here). In the manifest above, I'd included a uses-sdk node that simply specifies a tools:node attribute. This specific configuration tells the manifest processor to replace any attributes from uses-sdk nodes in lower-priority manifests (such as library manifests) with the attributes in the uses-sdk node with the tools:node="replace" attribute. Since Gradle also inserts minSdkVersion and targetSdkVersion from your build.gradle into this uses-sdk node, that's all we really need to add.Now you should be able to run your application on any device supported by your minSdkVersion, while taking advantage of the neat new views and utilities in the support lib!

关于android - 这是什么意思 <uses-sdk tools :overrideLibrary ="com.google.android.gms"/> in Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27590907/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com