我是 Android Studio 的新手,所以对于有经验的人来说这可能听起来很愚蠢。
我在 Android Studio 中收到一条错误消息:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value
value=(25.3.1) from [com.android.support:design:25.3.1]
AndroidManifest.xml:27:9-31
is also present at [com.android.support:appcompat-v7:26.0.0-alpha1]
AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at
AndroidManifest.xml:25:5-27:34 to override.
我用 Google 搜索了这个问题并尝试自行解决它,但是,我发现的类似问题并不是完全相同的错误。
尽管我了解其中的一些内容,但我的经验不足以理解并为它生成修复程序。
我可能需要为此提供更多信息,如果需要,请告诉我。
编辑:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.g732d.appname"
>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".HomeActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Patients" />
<activity android:name=".NewPatient" />
<activity android:name=".StartActivity"></activity>
</application>
</manifest>
build.gradle(项目:appname):
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(模块:App):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.g732d.appname"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
}
第二次编辑:
根据 Arefeh 的回答和 Kunal 的评论,我通过将 compile 'com.android.support:design:25.3.1'
替换为 compile 'com. android.support:design:26.0.0-beta2'
.
为此,我必须在 build.gradle (Project: appname)
中添加 maven { url "https://maven.google.com"}
> allprojects{}
中的文件(已在上面更新以说明这一点)。
现在我不断收到一个渲染错误,显示无法实例化一个或多个类
。根据我在 Activity 中使用的内容,每个 Activity 的类(class)都不同,例如
The following classes could not be instantiated:
- android.support.v7.widget.AppCompatImageView
...
...
最佳答案
我猜问题出在支持库版本之间的差异。将您的设计库版本更改为 26 或更高版本。 编译 'com.android.support:design:26.+'
关于安卓工作室错误 : Execution failed for task ':app:processDebugManifest' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44583765/