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 trialAbdulmajeed Alroumi
3,719 PointsThe project cant run. I tried everything
The error says Error (16,0) The project mememaker may be using version of gradle that does not contain a method. The build file may be missing a gradle plugin.
Android studio version 1.1.0 Here is a my build.gradle:
apply plugin: 'com.android.application'
android { compileSdkVersion 21 buildToolsVersion "21.1.2"
defaultConfig {
applicationId "jasonphillipsdev.stormy"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.squareup.okhttp:mockwebserver:2.2.0' compile 'com.jakewharton:butterknife:6.1.0' compile 'com.android.support:recyclerview-v7:22.0.0'
}
Please help.
Thanks
Abdulmajeed Alroumi
3,719 PointsJames Simshaw,
I did all of that but it will not let it sync. However, when I rebuild the project I get this error:
Error:(16) A problem occurred evaluating project ':app'.
Could not find method minifyEnabled() for arguments [false] on BuildTypeDsl_Decorated{name=release, debuggable=false, testCoverageEnabled=false, jniDebugBuild=false, renderscriptDebugBuild=false, renderscriptOptimLevel=3, applicationIdSuffix=null, versionNameSuffix=null, runProguard=false, zipAlign=true, signingConfig=null, embedMicroApp=true}.
Thanks, Abdul
13 Answers
James Simshaw
28,738 PointsHello,
I worked around a bit through your project and it looks like if you use the following for your app level build.gradle file, it should work.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId 'jasonphillipsdev.stormy'
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName '1.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/commons-io-2.4.jar')
compile 'com.android.support:support-v13:21.0.3'
}
This at least allowed me to build and run the app on my system.
Abdulmajeed Alroumi
3,719 PointsThank you very much, thank you so much. IT IS WORKING Can you explain to me what was wrong with it?
James Simshaw
28,738 PointsI hate to say this, but its something I've been trying to figure out since I posted the reply. I have no idea if its the combination of a few things or whitespace or some other piece of formatting. I will tell you how I came up with this since that might help in the future. What I did was take a known working build.gradle file(in this case, the one the base source file for the project in the teacher's notes section) and add most of your changes in, attempting to compile it with each change until I had the final product above which at least compiled.
Abdulmajeed Alroumi
3,719 PointsWell, at least you got it running. Now I can go start the course.
Thanks again James
Nicolas Hampton
44,638 PointsThanks a lot for going through this before I had to start this class. Two classes of outdated code what great practice, but three I must admit is a bit much.
Nicolas
James Simshaw
28,738 PointsHello,
If you're running a version of Android Studio prior to 1.0, could you try changing minifyEnabled to runProguard? The other option would be to update to the most recent version and keep your build.gradle the same.
Abdulmajeed Alroumi
3,719 PointsOk, I will try that. Although, I am not sure if that will work. I will update you Thanks James
Abdulmajeed Alroumi
3,719 PointsJames, It is still not working. I am not sure why. I put it on the default build.gradle It is driving me crazy.
James Simshaw
28,738 PointsThe only other thing I can think of is your other project build.gradle file needs updated so that the newest version of gradle is pulled in. The only mention of your problem I have found so far on stackoverflow is here, which went along with the thought that replacing minifyenabled with runProguard would fix things. Otherwise, could you also post that build.gradle file?
Abdulmajeed Alroumi
3,719 PointsI am getting new error now.
This one:
Error:Unable to load class 'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling'. Possible causes for this unexpected error include:<ul><li>You are using JDK version 'java version "1.7.0_06-ea"'. Some versions of JDK 1.7 (e.g. 1.7.0_10) may cause class loading errors in Gradle. Please update to a newer version (e.g. 1.7.0_67). <a href="open.project.structure">Open JDK Settings</a></li><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) <a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. <a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Thanks,
Abdulmajeed Alroumi
3,719 PointsThis is my Build.gradle file:
apply plugin: 'com.android.application'
android { compileSdkVersion 21 buildToolsVersion "21.1.2"
defaultConfig {
applicationId "jasonphillipsdev.stormy"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' }
Here is my other build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.12.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects { repositories { mavenCentral() } }
James Simshaw
28,738 PointsOk, lets try updating your "other" build.gradle file first, so that it looks like
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0+' // <-- This line here is the one one to change
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
}
}
and then change runProguard back to minifyEnabled in your the app build.gradle file.
Abdulmajeed Alroumi
3,719 PointsOk, now it is saying Error loading project: cannot load module mememaker and a message shows up giving me the option if I want to remove the module mememaker? Do I remove it ?
James Simshaw
28,738 PointsNo, if you removed the module, it would remove your entire project. Something just isn't adding up, but I'm at a loss at the moment as to why.
Abdulmajeed Alroumi
3,719 PointsThe class path you told me to change. classpath 'com.android.tools.build:gradle:1.0.0'
My android studio version is: 1.1.0 why do I put it at 1.0.0 ?
James Simshaw
28,738 PointsSorry, that was because I apparently read an out of date article about the most recent version of the gradle plugin. Apparently, the newest version is 1.2.2 at least according to here. Android Studio version and Gradle plugin version doesn't necessarily have to line up.
Abdulmajeed Alroumi
3,719 PointsOk, I am going to change to 1.2.2 and see what happens.
Abdulmajeed Alroumi
3,719 PointsThese are the errors I am getting right now:
Error:(6, 31) error: package android.support.v13.app does not exist Error:(16, 43) error: cannot find symbol class FragmentPagerAdapter Error:(24, 5) error: method does not override or implement a method from a supertype Error:(35, 5) error: method does not override or implement a method from a supertype Error:(44, 5) error: method does not override or implement a method from a supertype Error:(39, 19) error: method setAdapter in class ViewPager cannot be applied to given types; required: PagerAdapter found: SectionsPagerAdapter reason: actual argument SectionsPagerAdapter cannot be converted to PagerAdapter by method invocation conversion Error:Execution failed for task ':app:compileDebugJava'.
Compilation failed; see the compiler error output for details.
James, Thank you very much for your time and helping me with the my problem
Abdulmajeed Alroumi
3,719 PointsError:FAILURE: Build failed with an exception.
What went wrong: Task 'generateDebugTestSources' not found in project ':app'. Some candidates are: 'generateDebugResources'.
Try: Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
James Simshaw
28,738 PointsIs there anyway you could post your code to github or something so I can try running things here? I just opened the starter files for this project, let Android Studio fix the gradle plugin version on its own and then had to change runProguard to minifyEnabled and everything worked.
Abdulmajeed Alroumi
3,719 PointsJames, I have added my code to github. Here is the link: https://github.com/Majeedll/App
Thanks, Abdul
James Simshaw
28,738 PointsJames Simshaw
28,738 PointsHello,
When do you get this error? Do you still get it if you do Build, Clean Project? How about after File, Invalidate Caches/Restart?