我正在学习HeadFirst安卓开发教程,并在添加之后遇到了一些问题:私有ActionBarDrawerToggle drawerToggle;
控件被取消推荐,所以我按照Stack上的说明来解决这个问题,将com.android.support:appcompat-v7:26.0.0-alpha1添加到应用模块依赖项中。
但是现在我得到了以下构建错误:
错误:任务执行失败“:app:processDebugManifest”。
清单合并失败:属性meta#android.Support.vERSION@value value=(25.3.1)来自com.android.Support-v7:25.3.1 AndroidManifest.xml:24:9-31也存在于value= AndroidManifest.xml:27:9-38 value=(26.0.0-字母1)。建议:在AndroidManifest.xml:22:5-24:34的元素中添加‘tools:replace=:android:value’来覆盖。
以下是代码:
发布于 2017-04-07 08:11:05
问题是,所有支持相同版本和主要版本的库都必须与编译SDK版本匹配。
因此,尝试强制使用特定的支持库版本。把这个放在你的build.gradle应用模块的末尾。
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}发布于 2018-04-05 00:03:21
如果您还没有这样做,那么首先将这一行添加到您的清单标记中:
xmlns:tools="http://schemas.android.com/tools"示例:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.winanainc"
android:versionCode="3"
android:versionName="1.2"
xmlns:tools="http://schemas.android.com/tools">然后在应用程序中添加这个元标记来覆盖构建工具版本,例如,我选择了25.3.1版本。
<application>
...
..
<meta-data
tools:replace="android:value"
android:name="android.support.VERSION"
android:value="25.3.1" />
</application>发布于 2018-07-23 05:03:20
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<meta-data
tools:replace="android:value"
android:name="android.support.VERSION"
android:value="26.0.0" />
</application>https://stackoverflow.com/questions/43140059
复制相似问题