Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Eston Burciaga
Eston Burciaga
1,729 Points

Gradle DSL method not found: runProguard()

I just installed Android Studio 1.0, build AI-135.1629389 so that I could use the same version of AS that is being used in the Lists application. I loaded my previous project "Interactive Story" that worked fine with an earlier version of AS. I am having a problem getting it to run correctly - I am getting the following error:

Error:(16, 0) Gradle DSL method not found: 'runProguard()' Possible causes:<ul><li>The project 'Interactive Story' may be using a version of Gradle that does not contain the method. <a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin. <a href="apply.gradle.plugin">Apply Gradle plugin</a></li>

It tells me to "Open 'Messages' View; Show log in Windows Explorer. Well I did open the log, but it means nothing to me. I also tried to add the method "runProguard()" in the lis that popped up when I clicked on the error message, but I did not see that method in the list to add.

How do I get this new version of AS to work?

6 Answers

Hello,

You just need to change any instance of runProguard in your build.gradle files to minifyEnabled and things should be able to work from there. If you still are having trouble, please let us know and we'll try to assist you further.

Eston Burciaga
Eston Burciaga
1,729 Points

I can make the change, but I have no idea where to find the build.gradle files. (I'm still pretty new at developing with android).

The easiest way is to be in the Android view in the project section on the left hand side of Android Studio. The two most common modes I've seen it in are Project or Android view modes. If you are in Project view mode, change it to Android mode. Then in the section labeled Gradle Scripts find the build.gradle file that has Module: App next to it. I'll try to see if I can dig up some screenshots to help show where this is, but please let us know if this is clear or if it needs to be made clearer.

Eston Burciaga
Eston Burciaga
1,729 Points

I am able to get to the android mode and found the gradle files. How do I search across all of the scripts in the gradle files for the use of "runProguard"?

There should only be one instance of runProguard and that should be in the App build.gradle file.

Eston Burciaga
Eston Burciaga
1,729 Points

Thanks for all the help I've been getting. I am getting closer, but ... when I try to "sync project with gradle files", I get the error:

"Error:A problem occurred configuring project ':app'.

The 'java' plugin has been applied, but it is not compatible with the Android plugins."

What now?

I haven't seen that error message yet personally, what version of Java do you have installed and is it the JRE or JDK that you have installed?

Eston Burciaga
Eston Burciaga
1,729 Points

I have Java 8 Update 45 installed JRE 1.80_45 and JRE 1.80_25, with the Java SE Dev Kit 7 update 79 installed on my computer.

I just downloaded more of the sdk items into AS. I tried to create a brand new project, set to run under android 14, and I get the following errors.... I'm so confused and frustrated!

C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.1\res\values-v23\values-v23.xml Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\estpn\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe package -f --no-crunch -I C:\Users\estpn\AppData\Local\Android\sdk\platforms\android-21\android.jar -M C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\intermediates\res\debug -A C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\intermediates\assets\debug -m -J C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\generated\source\r\debug -F C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\intermediates\res\resources-debug.ap_ --debug-mode --custom-package com.example.estpn.stormy -0 apk --output-text-symbols C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\intermediates\symbols\debug Error Code: 1 Output: C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\intermediates\res\debug\values-v23\values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. C:\Users\estpn\AndroidStudioProjects\Stormy\app\build\intermediates\res\debug\values-v23\values.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Information:BUILD FAILED

I only have one idea at this point. Uninstall all of your installed Java versions and install a singular JDK. You might be having problems from having two versions installed and you might be pointing to the JRE instead of the JDK

Eston Burciaga
Eston Burciaga
1,729 Points

I'll try it and get back.

Eston Burciaga
Eston Burciaga
1,729 Points

Sorry it took so long for me to get back to my own problem…

I uninstalled all of my Java files as well as Android Studio. Then, I installed the jdk1.8.0_60 which also installed jre1.8.0_60. I updated my JAVA_HOME variable to point to my jdk1.8.0_60 directory. Then I re-installed Android Studio.

I then created a new blank project to run on API 14: Android 4.0 and when it built the project, I got the following errors:

“C:\Users\estpn\AndroidStudioProjects\Test\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.1\res\values-v23\values-v23.xml Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. Error:Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\estpn\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe package -f --no-crunch -I C:\Users\estpn\AppData\Local\Android\sdk\platforms\android-21\android.jar -M C:\Users\estpn\AndroidStudioProjects\Test\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S C:\Users\estpn\AndroidStudioProjects\Test\app\build\intermediates\res\debug -A C:\Users\estpn\AndroidStudioProjects\Test\app\build\intermediates\assets\debug -m -J C:\Users\estpn\AndroidStudioProjects\Test\app\build\generated\source\r\debug -F C:\Users\estpn\AndroidStudioProjects\Test\app\build\intermediates\res\resources-debug.ap_ --debug-mode --custom-package com.example.estpn.test -0 apk --output-text-symbols C:\Users\estpn\AndroidStudioProjects\Test\app\build\intermediates\symbols\debug Error Code: 1 Output: C:\Users\estpn\AndroidStudioProjects\Test\app\build\intermediates\res\debug\values-v23\values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. C:\Users\estpn\AndroidStudioProjects\Test\app\build\intermediates\res\debug\values-v23\values.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'. Information:BUILD FAILED”

Why is it not finding the parent resources for “Button:Colored” and “Button:Inverse”? I’m so frustrated because when I installed the previous version of AS, it was a very simple to download and run – no errors at all.

Any more ideas? It can’t be as hard to install the new version of AS as it is becoming for me.

Hello,

I haven't seen this before, but a quick search makes it look like you're compiling against a different API version than you're trying to use for the support libarary. Could you post your build.gradle files? The stackoverflow post I looked at is available here.

Eston Burciaga
Eston Burciaga
1,729 Points

Here is my build.gradle (Module:app) file:

apply plugin: 'com.android.application'

android { compileSdkVersion 21 buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.example.estpn.test"
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.1' }

Here is my build.gradle (Project:Test) file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects { repositories { jcenter() } }

Hello,

Your compileSdkVersion is set to 21 while you're loading the support library for SDK 23 via the line

compile 'com.android.support:appcompat-v7:23.0.1'

I'd recommend your compileSdkVersion to 23 and buildToolsVersion to 23.0.1, which should bring everything in line to compile. If not, could you put the code on GitHub and I could take a look at it and see what else might be wrong.