在更新到最新的0.2.9版本后,我无法在Android Studio中创建新项目。我正在使用OSX并收到以下错误消息: “3字节UTF-8序列的字节2无效。”
检查日志后,我看到以下内容:
2013-09-17 13:38:29,891 [ 110887] WARN - .project.GradleProjectImporter - com.intellij.openapi.externalSystem.model.ExternalSystemException: Invalid byte 2 of 3-byte UTF-8 sequence.
at com.android.tools.idea.gradle.project.ProjectImportErrorHandler.createUserFriendlyError(ProjectImportErrorHandler.java:204)
at com.android.tools.idea.gradle.project.ProjectImportErrorHandler.getUserFriendlyError(ProjectImportErrorHandler.java:144)
at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver$1.fun(AndroidGradleProjectResolver.java:136)
at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver$1.fun(AndroidGradleProjectResolver.java:126)
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:161)
at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.resolveProjectInfo(AndroidGradleProjectResolver.java:126)
at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.resolveProjectInfo(AndroidGradleProjectResolver.java:76)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:87)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:44)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:53)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:130)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:120)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:407)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$1.run(ExternalSystemUtil.java:454)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:468)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$6.run(ProgressManagerImpl.java:279)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:207)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
at com.intellij.openapi.application.impl.ApplicationImpl$10$1.run(ApplicationImpl.java:675)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:434)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:151)
我对旧项目也有同样的问题。有人有这个问题吗?我该如何解决?我发现问题出在Gradle上,但不幸的是我不是Gradle用户:/
编辑:我也看到了这个:Gradle 'TodoNotesAppProject' project refresh failed:
Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.7-bin.zip'.
A problem occurred configuring project ':TodoNotesApp'.
A problem occurred configuring project ':TodoNotesApp'.
Could not resolve all dependencies for configuration ':TodoNotesApp:classpath'.
Could not resolve org.ow2.asm:asm-analysis:4.0.
Required by:
TodoNotesAppProject:TodoNotesApp:unspecified > com.android.tools.build:gradle:0.5.7 > com.android.tools.lint:lint:22.2.0 > com.android.tools.lint:lint-checks:22.2.0
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 3-byte UTF-8 sequence.
Invalid byte 2 of 3-byte UTF-8 sequence
EDIT2(build.gradle文件):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
dependencies {
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.android.support:gridlayout-v7:18.0.0'
compile 'com.android.support:support-v4:18.0.0'
}
答案 0 :(得分:4)
我从Tor Norbye得到了G +的回答。 如果我改变了
classpath 'com.android.tools.build:gradle:0.5.+'
将build.gradle中的行添加到
classpath 'com.android.tools.build:gradle:0.5.6'
它可以作为临时解决方案。
答案如下:
“我不是Maven / Gradle专家,但听起来存储库中存在一些损坏的二进制文件?无论如何,这种依赖性使得它看起来像是在使用新版本的Android插件(0.5。 7)。也许尝试使用0.5.6(通过在build.gradle中指定它而不是0.5。+)作为临时解决方法?(不是永久解决方案,因为0.5.7中还有其他重要的修复方法,因此我们需要找出真正的问题。)“