当前位置: 首页 > 知识库问答 >
问题:

升级到androidX Zip文件“…”后已包含条目“AndroidManifest”。xml’,生成时无法覆盖错误

越嘉石
2023-03-14

我是Android开发新手,最近被分配到一个Android项目,该项目已经一年多没有更新了。我在尝试构建时出现以下错误。

这个项目是在android X之前完成的,我刚刚用android studio迁移到android X。Gradle版本是3.8,现在是7.0。迁移和升级完成后,我在构建时开始遇到这个问题

请指导我如何修理它。

失败:生成失败,出现异常**

出错原因:任务': app: packageDebug'执行失败。执行com.android.build.gradle.tasks.PackageAndroid工件$增量拆分器运行可压缩文件'C:\用户...\app\build\输出\apk\debug\app-debug.apk'已包含条目'AndroidManifest.xml',无法覆盖

尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。运行--扫描以获得完整的见解。获取更多帮助https://help.gradle.org此版本中使用了不推荐的Gradle功能,使其与Gradle 8.0不兼容。使用“-warning mode all”显示单个弃用警告。看见https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings生成在3s内失败

这是我的gradle文件:

    apply plugin: 'com.android.application'
    apply plugin: 'com.google.firebase.crashlytics'

android {
    compileSdkVersion 31
    defaultConfig {
        applicationId "com.myapp.app"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 108
        versionName "3.7"
        testInstrumentationRunner 'androidx.test.runner.AndroidJsUnitRunner'
        multiDexEnabled true
    }
    allprojects {
        repositories {
            jcenter()
            google()
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    namespace 'com.myapp.app'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('androidx.appcompat:appcompat:1.0.0', {
    exclude group: 'com.google.android.gms'
})
implementation('androidx.cardview:cardview:1.0.0', {
    exclude group: 'com.google.android.gms'
})
implementation('androidx.recyclerview:recyclerview:1.0.0', {
    exclude group: 'com.google.android.gms'
})
implementation('androidx.constraintlayout:constraintlayout:1.1.3', {
    exclude group: 'com.google.android.gms'
})
implementation('com.google.android:flexbox:1.0.0', {
    exclude group: 'com.google.android.gms'
})
implementation('com.google.android.material:material:1.0.0', {
    exclude group: 'com.google.android.gms'
})
implementation('com.squareup.picasso:picasso:2.71828', {
    exclude group: 'com.google.android.gms'
})
implementation('com.squareup.retrofit2:retrofit:2.3.0', {
    exclude group: 'com.google.android.gms'
})
implementation('com.squareup.retrofit2:converter-gson:2.3.0', {
    exclude group: 'com.google.android.gms'
})
implementation('com.squareup.okhttp3:okhttp:3.4.1', {
    exclude group: 'com.google.android.gms'
})
implementation('com.squareup.okhttp3:logging-interceptor:3.4.1', {
    exclude group: 'com.google.android.gms'
})
implementation('pl.droidsonroids.gif:android-gif-drawable:1.2.15', {
    exclude group: 'com.google.android.gms'
})
implementation 'com.google.android.gms:play-services-wallet:16.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'com.google.android.gms:play-services-basement:16.1.0'
implementation('io.card:android-sdk:5.5.1', {
    exclude group: 'com.google.android.gms'
})
implementation('com.facebook.android:audience-network-sdk:5.0.0', {
    exclude group: 'com.google.android.gms'
})
implementation ('androidx.constraintlayout:constraintlayout:1.1.3',{
    exclude group: 'com.google.android.gms'
})
implementation ('androidx.legacy:legacy-support-v4:1.0.0',{
    exclude group: 'com.google.android.gms'
})

implementation platform('com.google.firebase:firebase-bom:29.0.3')

implementation ('com.google.firebase:firebase-crashlytics',{
    exclude group: 'com.google.android.gms'
})
implementation ('com.google.firebase:firebase-analytics',{
    exclude group: 'com.google.android.gms'
})

implementation ('com.google.firebase:firebase-core',{
    exclude group: 'com.google.android.gms'
})
implementation('com.google.firebase:firebase-messaging', {
    exclude group: 'com.google.android.gms'
})
implementation('androidx.work:work-runtime:2.7.1', {
    exclude group: 'com.google.android.gms'
})


implementation ('com.facebook.android:facebook-login:12.2.0',{
    exclude group: 'com.google.android.gms'
})
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

implementation('androidx.gridlayout:gridlayout:1.0.0', {
    exclude group: 'com.google.android.gms'
})

implementation ('androidx.multidex:multidex:2.0.0',{
    exclude group: 'com.google.android.gms'
})
/* implementation('com.smartyads:ad-container:0.4.9', {
    exclude group: 'com.google.android.gms'
    transitive = true
})*/
implementation ('com.inmobi.monetization:inmobi-ads:8.1.3',{
    exclude group: 'com.google.android.gms'
})

}

apply plugin: 'com.android.application'
// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        mavenLocal()
        flatDir {
            dirs '../libs'
        }
        maven { url "https://jitpack.io" }
        maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
        maven { url "https://dl.bintray.com/smartyads/maven/" }
        maven {
            url 'https://maven.google.com/'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

共有2个答案

林英武
2023-03-14

验证您的项目中没有不属于源代码集的额外AndroidManifest.xml。当我最近在旧项目中修复此问题时,我发现资源/目录中还有另一个AndroidManifest.xml。

柴瀚昂
2023-03-14

根据您使用的Android Studio版本和Gradle插件版本,罪魁祸首可能是新的打包工具:https://developer.android.com/studio/releases/gradle-plugin#zipflinger

返回使用旧工具的最简单方法是在渐变中添加这一行。属性文件:

android.useNewApkCreator=false
 类似资料:
  • 我正在从Udacity构建一个示例项目。到目前为止,这还可以正常工作,但升级到AndroidStudio 3.2.1后,我面临以下构建错误。 渐变版本:4.6 项目链接:https://github.com/udacity/ud851-Sunshine/tree/student/S02.02-Solution-Menus 我怎么才能修好它?

  • 问题内容: 我有一个用于签署XML文档的Java应用程序。将Java升级到最新版本(Java7u25)后,它将停止工作。我收到以下错误: 恢复为java7u21解决了该问题。XML Dig Sig API中是否有任何导致此错误的更改? 问题答案: 这里同样的问题。由于不断发展,似乎是JVM内部的错误。 我已经将其归结为 在Java 7u21及之前的版本中: 在Java 7u25中: 指的是XML

  • 我们在Liferay 7.0.6中实现了一个corejspook模块来定制user_action.jsp,它工作得很好。 升级到Liferay 7.3.6后,它停止工作。通过在gogo shell中搜索,我已经确保了我们将jsp替换成的模块是正确的。我还查看了源代码,以确认包含。jsp是对的。我将版本号更新为Liferay 7.3捆绑包版本(5.0.53)。我的bnd中的条目。bnd是:Fragm

  • 昨天晚上我把Xcode SDK升级到第10版,然后发现我无法构建。 我得到了这个错误: 找不到生成输入文件:'/users/call01/library/developer/xcode/deriveddata/comp-lite-apps-gytvmossqptokeafrddvvmnlzadk/Build/products/debug-iphoneos/sg11.app/sg11 这在我升级之前

  • 我开始使用web3j,我想生成智能合同包装。根据文档,可以这样做: 这非常有效。您需要.bin和.abi文件。使用此命令也很容易生成: 在我不进口Openzeppelin的合同上,这很有效。但是在我导入Openzeppelin的合同上,当调用solcjs命令时,我得到一个错误: 语法我如何在Solidity的智能合同中导入此库: 我使用语用可靠性 Smartcontract有效,我用hardhat

  • 我最近更新了我的项目的gradle版本,从2.14.1到3.0。从那以后,gradle构建每次都失败,出现以下错误: 错误:原因:org.gradle.api.internal.tasks.defaultTaskinputs$TaskinputUnionFileCollection无法强制转换为org.gradle.api.internal.file.Collections.defaultConf