gpt4 book ai didi

android-studio - Espresso-android jar - android studio 8.x 中的 'Error in opening zip file'

转载 作者:行者123 更新时间:2023-12-03 17:53:26 24 4
gpt4 key购买 nike

我遇到了这个错误,我已经尝试过此处所述的解决方案:Android studio - Failed to complete gradle execution - error in opening zip file

这个错误让我很痛苦,我试过删除 .gradle 文件夹。我注意到 .idea\libraries 文件夹中有一堆 xml,我尝试删除它(认为它存储了错误的东西),但也不是。

我已将范围缩小到从 espresso-android 站点下载的 jar、espresso-1.1.jar 和测试运行程序 - 我已经验证在没有它们的依赖项中它仍然有效。一旦它们被添加,它就不会。我什至可以添加其他依赖项并且它有效。所以我不知道为什么这些 Jar 是异常(exception)但它们不起作用。

:app:compileDebugJava
error: error reading /Users/busyer_jonathan/AndroidStudioProjects/TestVersion/app/libs/testrunner-runtime-1.1.jar; error in opening zip file
error: error reading /Users/busyer_jonathan/AndroidStudioProjects/TestVersion/app/libs/testrunner-1.1.jar; error in opening zip file
error: error reading /Users/busyer_jonathan/AndroidStudioProjects/TestVersion/app/libs/testrunner-runtime-1.1.jar; error in opening zip file
error: error reading /Users/busyer_jonathan/AndroidStudioProjects/TestVersion/app/libs/testrunner-1.1.jar; error in opening zip file

:app:preDexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.zip.ZipFile.<init>(ZipFile.java:158)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
1 error; aborting

FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --output /Users/busyer_jonathan/AndroidStudioProjects/TestVersion/app/build/intermediates/pre-dexed/debug/testrunner-runtime-1.1-9d180daedad4578babced4673aa1a80a8f70f413.jar /Users/busyer_jonathan/AndroidStudioProjects/TestVersion/app/libs/testrunner-runtime-1.1.jar
Error Code:
1
Output:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.zip.ZipFile.<init>(ZipFile.java:158)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
1 error; aborting


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

这是我的构建文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "com.example.edu.testversion"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
//testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'LICENSE.txt'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/json_simple-1.1.jar',
'libs/testrunner-1.1.jar',
'libs/testrunner-runtime-1.1.jar')
compile files('libs/scribe-1.3.5.jar')
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.android.gms:play-services:5.0.77'
compile 'com.android.support:appcompat-v7:20.0.0'
androidTestCompile 'org.mockito:mockito-core:1.9.+'
androidTestCompile 'org.objenesis:objenesis:1.2'
//Espresso dependencies includes guava, hamcrest, dagger, javax annotation
androidTestCompile 'com.google.guava:guava:14.0.1',
'com.squareup.dagger:dagger:1.1.0',
'org.hamcrest:hamcrest-integration:1.1',
'org.hamcrest:hamcrest-library:1.1'
}

最佳答案

我发现问题是我从 espresso 站点下载 jar :https://code.google.com/p/android-test-kit/source/browse/#git通过右键单击它们并单击“另存为”-确实下载了 jar ,它们只是出于某种奇怪的原因而无法工作。即使重复这个,他们仍然没有工作 - 我检查了我是否获得了许可(因为我有一台 mac,它有点敏感)。

我必须以 zip 格式下载所有文件,解压缩整个文件,然后手动挑选我需要的所有 jar 并将其拖出各自的文件夹。

编辑:enter image description here您会在屏幕截图的右下方看到“下载 zip”。这就是我点击并解压缩的工作 jar 。

关于android-studio - Espresso-android jar - android studio 8.x 中的 'Error in opening zip file',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25276201/

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