gpt4 book ai didi

android - 升级到 androidX 后 Zip 文件 '...' 已经包含条目 'AndroidManifest.xml' ,构建时无法覆盖错误

转载 作者:行者123 更新时间:2023-12-04 23:49:02 25 4
gpt4 key购买 nike

我是安卓开发的新手,最近被分配到一个安卓项目,一年多没有更新。尝试构建时出现以下错误。
这个项目是在 android X 之前制作的,我刚刚用 android studio 迁移到了 android X。 Gradle 版本是 3.8,现在是 7.0。迁移和升级完成后,我开始在构建时遇到这个问题
请指导我如何解决它。
失败 :构建失败并出现异常。**

What went wrong:Execution failed for task ':app:packageDebug'.A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnableZip file 'C:\Users...\app\build\outputs\apk\debug\app-debug.apk' already contains entry 'AndroidManifest.xml', cannot overwrite


Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.Get more help at https://help.gradle.orgDeprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warningsBUILD FAILED in 3s


这是我的gradle文件:
build.gradle(模块:MyApp.app)
    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'
build.gradle(项目:MyApp)
// 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
}

最佳答案

根据您使用的 Android Studio 版本和 Gradle 插件版本,罪魁祸首可能是新的打包工具:https://developer.android.com/studio/releases/gradle-plugin#zipflinger
回退到使用旧工具的最简单方法是在 gradle.properties 中添加这一行。文件:

android.useNewApkCreator=false

关于android - 升级到 androidX 后 Zip 文件 '...' 已经包含条目 'AndroidManifest.xml' ,构建时无法覆盖错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70467985/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com