gpt4 book ai didi

java - 任务 ':app:transformClassesWithJarMergingForDebug 执行失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:36:49 25 4
gpt4 key购买 nike

我创建了一个 Android 应用程序并且运行在 API 级别 21 以上。但不能在 API 级别 21 以下运行。

这是错误日志:

错误:任务 ':app:transformClassesWithJarMergingForDebug' 执行失败。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.class帮助我度过难关

下面是我的gradle代码:

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "*******"
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
packagingOptions {
exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
}

dependencies {
compile fileTree(exclude: 'android-support-*.jar', dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':simple-crop-image-lib')
// compile 'com.github.navasmdc:MaterialDesign:+'
compile project(':material-login')
compile 'com.android.support:multidex:1.0.1'
compile ('com.android.support:appcompat-v7:23.4.0'){
exclude module: 'support-v4'
}
}

最佳答案

首先编译构建

compile 'com.android.support:multidex:1.0.1'

在你的 AndroidManifest.xml 添加这行 android:name

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name="android.support.multidex.MultiDexApplication"
>

并且在你的build.gradle中添加

dexOptions {
//incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}


packagingOptions {
exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}

关于java - 任务 ':app:transformClassesWithJarMergingForDebug 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38765538/

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