昨天,我更新了我的android工作室以发布2.3.1。
从那时起我收到以下错误
同步gradle项目时 Gradle sync failed: Cause: invalid CEN header (bad signature)
idea.log文件显示以下内容:
2017-04-06 19:02:04,357 [ 21782] WARN - nal.AbstractExternalSystemTask - Cause: invalid CEN header (bad signature) com.intellij.openapi.externalSystem.model.ExternalSystemException: Cause: invalid CEN header (bad signature)
at com.android.tools.idea.gradle.project.sync.idea.ProjectImportErrorHandler.getUserFriendlyError(ProjectImportErrorHandler.java:86)
at com.android.tools.idea.gradle.project.sync.idea.AndroidGradleProjectResolver.getUserFriendlyError(AndroidGradleProjectResolver.java:361)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:769)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:749)
at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:227)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:112)
Caused by: java.util.zip.ZipException: invalid CEN header (bad signature)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.loadModuleProperties(DefaultModuleRegistry.java:184)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.loadModule(DefaultModuleRegistry.java:88)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.getModule(DefaultModuleRegistry.java:77)
at org.gradle.api.internal.classpath.DefaultPluginModuleRegistry.getPluginModules(DefaultPluginModuleRegistry.java:39)
at org.gradle.api.internal.DynamicModulesClassPathProvider.findClassPath(DynamicModulesClassPathProvider.java:47)
at org.gradle.api.internal.DefaultClassPathRegistry.getClassPath(DefaultClassPathRegistry.java:34)
at org.gradle.initialization.DefaultClassLoaderRegistry.<init>(DefaultClassLoaderRegistry.java:31)
at org.gradle.internal.service.scopes.GlobalScopeServices.createClassLoaderRegistry(GlobalScopeServices.java:224)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)
正如提到的其他一些主题,到目前为止已完成以下任务:
从工具中删除了gradle-xxx.zip文件并重新下载了zip文件,但似乎没有用。
我还创建了一个虚拟项目,看看这是否是项目特定问题,但是遇到了同样的问题
我还从sdk管理器中删除了SDK工具和SDK并再次安装它们但出现了同样的错误
我现在完全陷入困境,并没有看到前进的方向:(任何建议都会有所帮助
答案 0 :(得分:0)
尝试@Avishek Das建议,如果它不起作用,请尝试以下方法:
答案 1 :(得分:0)
最后通过从
更改build.gradle中的设置来解决此问题 com.android.tools.build:gradle:3.0.0
到
com.android.tools.build:gradle:2.3.1
答案 2 :(得分:0)
答案 3 :(得分:0)
答案 4 :(得分:0)
flutter clean
然后 flutter pub get
解决了我的问题