orrett3
orrett3

Reputation: 1038

Error:Cause: com.android.builder.BuilderConstants Android Studio

After updating to the beta version of Android Studio (0.8.0) from a canary build (0.6.0 i believe) I am getting a Error:Cause: com.android.builder.BuilderConstants error from Android Studio when trying to refresh my project.

Here is the log:

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)

Edit After removing apply plugin: 'android-test' from one of my modules that error is resolved.

Now I am getting:

    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'.
...
...

In D:\Users(User)\AndroidStudioProjects(Project)\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0-rc1\res\values-v21\values.xml

I do have the latest SDK downloaded so I'm not sure what the problem is...

Upvotes: 2

Views: 4157

Answers (6)

IgorGanapolsky
IgorGanapolsky

Reputation: 26831

Do you have an import statement in your build.gradle file? Like: import com.android.builder.core.BuilderConstants. If so, then your build.gradle needs to have:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'
    }
}

at the top right after the import statement.

Upvotes: 0

back track
back track

Reputation: 209

you have to make the target and compile version to L which meant that I could not run my app on older SDKs. If you want your app to run on SDK 19 and lower you have to set your compile and target version to 19 and your min SDK to whatever version you need.

Next you have to adjust your imports to the version that is compatible with the SDKs that you have chosen to compile for. For example if you want to use the v7 support library on sdk 19 you must import it like this: compile compile 'com.android.support:appcompat-v7:20.+'

Upvotes: 0

bsautner
bsautner

Reputation: 4822

In my case this was a dependency in my test libraries that caused this problem. If you compile your app on the command line with:

gradle --stacktrace

You'll see the line of code in your build.gradle file that is causing this problem. You probably need to update the version.

Upvotes: 0

Coder Roadie
Coder Roadie

Reputation: 860

I just had the same problem. What tacke suggested worked for me. The problem showed up when I imported an Eclipse library project into Android Studio.

In the app module, Android Studio created this in the build.gradle file:

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')
}

I had to change the compile referring to 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')
}

(note the addition of a ":19.+" in compile 'com.android.support:appcompat-v7:19.+')

Then I made sure my Compile Sdk Version was 19: (File->Project Structure->Compile Sdk Version) = 19.

Upvotes: 0

tacke
tacke

Reputation: 155

Check your appCompat-v7 version. It has a problem with backward compatibility that the newest one (21.0.0-rc1) tries to link UI components to Android L's Material ones. (But of course it fails because you just upgraded AndroidStudio version and not introduce the newest SDK!) So a possible fix is to specify appCompat-v7's version in build.gradle like this:

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

Upvotes: 3

CommonsWare
CommonsWare

Reputation: 1006974

That was moved to com.android.builder.core.BuilderConstants. Assuming that you are using BuilderConstants in your build.gradle file, you will need to adjust it to refer to the new package.

Upvotes: 2

Related Questions