Gradle
构建失败,出现以下错误。
清单合并失败:属性meta-data#android.support.VERSION@value 来自[com.android.support:design:26.0.0]的value =(26.0.0) AndroidManifest.xml:28:13-35也出现在 [com.android.support:appcompat-v7:26.1.0] AndroidManifest.xml:28:13-35 value =(26.1.0)。建议:添加'工具:replace =" android:value"'到AndroidManifest.xml:26:9-28:38的元素覆盖
我无法找到错误。我的gradle
版本是3.0.1。我的AndroidManifest.xml
文件位于下方。请帮忙!
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.vmac.WatBot">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_face"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
</activity>
<activity android:name=".SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/SplashTheme">>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
这是我的build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.example.vmac.chatbot"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
// Automatically pulls in core SDK
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support:recyclerview-v7:26.0.0'
implementation 'com.android.support:design:26.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.ibm.watson.developer_cloud:conversation:4.2.1'
implementation 'com.ibm.watson.developer_cloud:text-to-speech:4.2.1'
implementation 'com.ibm.watson.developer_cloud:speech-to-text:4.2.1'
implementation 'com.ibm.watson.developer_cloud:android-sdk:0.4.3'
implementation
'com.ibm.mobilefirstplatform.clientsdk.android:analytics:1.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.google.android.gms:play-services:10.0.1'
implementation 'com.android.support:multidex:1.0.1'
}
答案 0 :(得分:1)
在清单标记顶部的清单标记中添加此行:
xmlns:tools="http://schemas.android.com/tools"
&安培;像这样更新你的应用程序标签:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_face"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:value">
答案 1 :(得分:1)
我建议清理支持库依赖项以使其具有相同的发行版本。
implementation "com.android.support:design:26.1.0"
implementation "com.android.support:appcompat-v7:26.1.0"