Java 如何解决;TransformException:重复条目“;错误?
Gradle sync在运行时未显示任何错误,但当我尝试运行应用程序时,它显示错误 我试图删除重复的库,并添加了Java 如何解决;TransformException:重复条目“;错误?,java,android,xml,android-studio,Java,Android,Xml,Android Studio,Gradle sync在运行时未显示任何错误,但当我尝试运行应用程序时,它显示错误 我试图删除重复的库,并添加了MultiDex.install(这个)在myMainActivity中,并尝试清理和运行项目,但没有成功 错误: 错误:任务“:app:transformClassesWithJarMergingForDebug”的执行失败。com.android.build.api.transform.TransformException:java.util.zip.zipeException:重
MultiDex.install(这个)代码>在myMainActivity
中,并尝试清理和运行项目,但没有成功
错误:
错误:任务“:app:transformClassesWithJarMergingForDebug”的执行失败。com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:com/fathzer/soft/javaluator/demo/DemoApplet.class
我的毕业代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.kanwal.calculator_test"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true }
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-
rules.pro'} } }
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.1'
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 files('libs/javaluator-3.0.1.jar')}
从jar中排除重复的包:
compile('libs/javaluator-3.0.1.jar') {
exclude module: 'demo';}
尝试在项目根目录中的终端上运行此命令:
./gradlew clean
您已将此行添加到您的gradle
compile fileTree(include: ['*.jar'], dir: 'libs')
您可以删除冗余行,也可以删除上面的行本身
通过删除上面的行
我在终端中运行该命令,它显示:“.”不被识别为内部或外部命令、可操作程序或批处理文件。当删除(.)时,它显示:“/gradlew”不被识别为内部或外部命令、可操作程序或批处理文件。转到Android Studio右侧的gradle选项卡,然后从那里运行clean命令。我按照您的指示进行了清理,现在没有错误,但仍然没有在我的设备中运行应用程序。另外,在运行应用程序后,它会在主活动中将所有的R变为红色。现在会发生什么?尽可能多地描述问题该应用程序现在是无错误的,但在运行该应用程序后,MainActivity中的所有R都变为红色。我的设备上没有运行应用程序。我也试过了。删除了上面这一行,但没有解决错误,而是显示了许多其他错误。请将代码作为文本而不是图像包含。图像无法搜索,对某些用户来说很难阅读,外部图像可能会消失。好的,我在这里发布我的渐变代码:dependencies{compile fileTree(包括:['*.jar'],dir:'libs')compile'com.android.support:multidex:1.0.1'androidTestCompile('com.android.support.test.espresso:espresso core:2.2'),{排除组:'com.android.support',模块:'support annotations'})编译'com.android.support:appcompat-v7:26.+'compile'com.android.support.constraint:constraint布局:1.0.2'testCompile'junit:junit:4.12'编译文件('libs/javaluator-3.0.1.jar'))请编辑您的问题,而不是张贴在评论,这将更容易找到和阅读!我刚刚更新了我的问题。