错误:原因:com.android.builder.BuilderConstants Android Studio

时间:2014-06-27 21:59:53

标签: android android-studio

从canary版本更新到Android Studio(0.8.0)的测试版(我相信0.6.0)后,我在尝试刷新项目时从Android Studio收到Error:Cause: com.android.builder.BuilderConstants错误。

这是日志:

2014-06-27 17:05:52,702 [ 709722]   WARN - nal.AbstractExternalSystemTask - Cause: com.android.builder.BuilderConstants 
com.intellij.openapi.externalSystem.model.ExternalSystemException: Cause: com.android.builder.BuilderConstants
    at org.jetbrains.plugins.gradle.service.project.AbstractProjectImportErrorHandler.createUserFriendlyError(AbstractProjectImportErrorHandler.java:106)
    at org.jetbrains.plugins.gradle.service.project.BaseProjectImportErrorHandler.getUserFriendlyError(BaseProjectImportErrorHandler.java:153)
    at org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.getUserFriendlyError(BaseGradleProjectResolverExtension.java:358)
    at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:151)
    at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.getUserFriendlyError(AndroidGradleProjectResolver.java:269)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:367)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:333)
    at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:203)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:116)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:64)
    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:48)
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137)
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.execute(ExternalSystemUtil.java:406)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3$2.run(ExternalSystemUtil.java:483)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:471)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    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.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:380)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)

编辑 从我的一个模块中删除apply plugin: 'android-test'之后,错误已解决。

现在我得到了:

    Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
    Error:Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.
    Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
    Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
...
...

在D:\ Users(用户)\ AndroidStudioProjects(Project)\ build \ intermediates \ explosion-aar \ com.android.support \ appcompat-v7 \ 21.0.0-rc1 \ res \ values-v21 \ values.xml

我确实已经下载了最新的SDK,所以我不确定问题是什么......

6 个答案:

答案 0 :(得分:3)

检查您的appCompat-v7版本。 它具有向后兼容性的问题,最新的(21.0.0-rc1)尝试将UI组件链接到Android L的Material组件。 (但当然它失败了,因为你刚刚升级了AndroidStudio版本而没有推出最新的SDK!) 所以可能的解决方法是在build.gradle中指定appCompat-v7的版本,如下所示:

dependencies {
    compile 'com.android.support:appcompat-v7:19.+'
}

答案 1 :(得分:2)

已移至com.android.builder.core.BuilderConstants。假设您在BuilderConstants文件中使用build.gradle,则需要对其进行调整以引用新包。

答案 2 :(得分:0)

我遇到了同样的问题。什么 tacke 建议对我有用。当我将Eclipse库项目导入Android Studio时,问题出现了。

在app模块中,Android Studio在build.gradle文件中创建了它:

dependencies {
    compile 'com.android.support:support-v4:+'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'joda-time:joda-time:2.2'
    compile 'com.android.support:appcompat-v7:+'
    compile files('libs/httpclient-4.0.1.jar')
    compile files('libs/httpcore-4.0.1.jar')
    compile files('libs/httpmime-4.0.1.jar')
    compile files('libs/okhttp-1.1.0.jar')
}

我必须更改编译,参考appcompat-v7:

dependencies {
    compile 'com.android.support:support-v4:+'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'joda-time:joda-time:2.2'
    compile 'com.android.support:appcompat-v7:19.+'
    compile files('libs/httpclient-4.0.1.jar')
    compile files('libs/httpcore-4.0.1.jar')
    compile files('libs/httpmime-4.0.1.jar')
    compile files('libs/okhttp-1.1.0.jar')
}

(请注意在编译' com.android.support:appcompat-v7:19。+' )

然后我确保我的Compile Sdk版本是19 :(文件 - >项目结构 - >编译Sdk版本)= 19.

答案 3 :(得分:0)

在我的情况下,这是导致此问题的测试库中的依赖项。如果您使用以下命令在命令行上编译应用程序:

gradle --stacktrace

您将在build.gradle文件中看到导致此问题的代码行。您可能需要更新版本。

答案 4 :(得分:0)

你必须制作目标并将版本编译为L,这意味着我无法在较旧的SDK上运行我的应用程序。如果您希望您的应用程序在SDK 19及更低版本上运行,则必须将您的编译和目标版本设置为19,并将您的min SDK设置为您需要的任何版本。

接下来,您必须将导入调整为与您选择编译的SDK兼容的版本。例如,如果要在sdk 19上使用v7支持库,则必须像下面这样导入它:compile compile' com.android.support:appcompat-v7:20。+'

答案 5 :(得分:0)

您的build.gradle文件中是否有导入语句?喜欢: import com.android.builder.core.BuilderConstants。如果是这样,那么您的 build.gradle 需要:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'
    }
}
导入语句后右上角的