sim*_*ler 5 java android manifest gradle
由于下载了最新的SDK并安装了Android Studio,因此我的项目无法构建。我收到以下消息:
清单合并失败,并出现多个错误
我的gradle应用:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.app.clupascu.oavm"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.chrisbanes:PhotoView:2.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)
我的清单
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.app.clupascu.oavm"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.chrisbanes:PhotoView:2.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)
在合并清单中这样写:
Merging Errors: Error: tools:replace specified at line:6 for attribute android:appComponentFactory, but no new value specified app main manifest (this file), line 5 Error: Validation failed, exiting app main manifest (this file)
Run Code Online (Sandbox Code Playgroud)
我尝试了其他问题的许多解决方案,但没有结果,非常感谢。
sai*_*mar 12
在我的应用程序中实现地图 API 时,我遇到了同样的情况。我通过在 AndroidManifest.xml 和 Gradle.properties 文件中添加以下代码解决了它。
在 AndroidMainfest.xml 添加了这段代码
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
tools:replace="android:appComponentFactory"
Run Code Online (Sandbox Code Playgroud)
在 gradle.properties添加了这段代码
android.useAndroidX=true
android.enableJetifier=true
Run Code Online (Sandbox Code Playgroud)
"tools:replace="android:appComponentFactory" <- 这行代码对 Manifest 合并说,您将为 android:appComponentFactory 属性提供新值,但您没有这样做。所以据我所知,您有两个选项:
删除工具:replace="android:appComponentFactory"
为 android:appComponentFactory" 属性提供新值
希望能帮助到你。
归档时间: |
|
查看次数: |
6446 次 |
最近记录: |