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 trialKevin Gonzales
4,638 PointsGradel error with minifyEnabled false
i replaced the grade run program with minifyEnabled false, however i get an error saying
Error:(15, 0) Gradle DSL method not found: 'minifyEnabled()' Possible causes:<ul><li>The project 'mememaker' 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>
no clue why, because my other projects have minifyEnabled in the gradual and work.
help please.
Ps not sure how outdated this course is, but it is still relevant right? As in the way we save (use data persistence) is still the same?
Kevin Gonzales
4,638 Pointssure!
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'com.teamtreehouse.mememaker'
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
minifyEnabled
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:19.0.+'
}
4 Answers
Harry James
14,780 PointsHey Kevin!
I've downloaded your project and managed to reproduce the problem.
I've noticed two issues with the project:
- It is using a version of Gradle that is unsupported (Android only supports 1.0 and up).
- The Gradle files seem to have gone corrupt - they need to be reset.
Update Gradle to a newer version
Open up the build.gradle file for the project. Add this dependency and remove any other ones (1.2.3 is the recommended version right now):
classpath 'com.android.tools.build:gradle:1.2.3'
Reset the gradle files
Right-click on your project and press Show in Explorer. Then, delete the .gradle and gradle directories.
After that, run a Gradle sync and the issue should go away. If not, you may need to run a Project Clean, Build or Invalidate Caches & Restart.
Hope it helps and if you have any more issues, give me a shout :)
Kevin Gonzales
4,638 PointsSweet it worked! thank you so much!!
Harry James
14,780 PointsWoohoo! Glad we got it sorted :)
Harry James
14,780 PointsHey Kevin!
Can you change the first line to
apply plugin: 'com.android.application'
and see if it passes with that? (Note: You'll need to run a gradle sync afterwards).
Kevin Gonzales
4,638 Pointsno it still failed. I got
Error:(14, 0) Could not find property 'minifyEnabled' 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}.
and a gradel synch fail
Kevin Gonzales
4,638 PointsIf it helps, for some reason my dependencies is highlighted and when i go to the yellow bars on the left i get a message saying " 'dependencies' cannot be applied to '(groovy.lang.Closure)' " and when i click more this pops out "This inspection reports assignments with incompatible types"
Harry James
14,780 PointsHey Kevin!
I traced the error back down to the
compile 'com.android.support:support-v13:19.0.+'
line in your code. Removing this will fix the error (It seems as though some new .+ version has came out that is breaking this as I previously used the same line of code).
You can swap it with this line:
compile 'com.android.support:support-v13:19.0.0'
which will fix the problem.
Hope it helps :)
Kevin Gonzales
4,638 PointsUnfortunately it still fails. Thanks for the try tough! Could you tell me if this course is still up to date on data persistence? Do we still do data persistence like we do it in this video? Or has new stuff come out for data persistence as well?
Harry James
14,780 PointsThe course should be relatively up-to-date. If there's anything missing or things that have changed, check the Questions section beneath the video where I and a few other students have added things.
If you still can't get your project working with the Gradle issue, feel free to send it to me and I'll see if I can reproduce and solve the problem.
Another thing I would try while I'm at it is hard-coding the false keyword:
minifyEnabled false
As I wonder if it's looking for that (It might not make any difference however - I ran my project just fine without it).
Let me know how it goes anyway :)
Kevin Gonzales
4,638 Pointsnope it still doesn't work lol. I even crossed my fingers! I would like to send it to you. how can I ?
Harry James
14,780 PointsTo share your project, right-click on it in Android Studio and press Show in Explorer. Then, upload your project directory into a service like Google Drive, Mega.co.nz, SkyDrive or another service of your choice.
Then, share the project via a URL and I'll download it and try and reproduce your problem, then find a solution.
If you use a service like GitHub, please just send me the link to your GitHub repository and I'll fork it.
Kevin Gonzales
4,638 PointsI am trying to use google drive, but it will only allow me to upload files not the folder. So would you only need the gradual file?
Harry James
14,780 PointsHey Kevin!
On Google Drive you can go here and click New >> Folder upload :)
Kevin Gonzales
4,638 PointsThanks! It is uploading!
Kevin Gonzales
4,638 Pointsdo i set the link for can view or can edit?
Kevin Gonzales
4,638 Pointsdo i set the link for can view or can edit?
Harry James
14,780 PointsHey Kevin!
Please set it to Can View.
I'll have to get back to you tomorrow though as it's getting quite late where I am. Speak to you soon :)
Diwesh Saxena
15,512 PointsI am preparing my file for release on google play .... My build.gradle release code looks like this
buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
and my progurad file is empty
Do I need to set minifyEnabled to "true"
Also do I need to pasted anything in proguard ?
Harry James
14,780 PointsHey Diwesh,
minifyProguard is now deprecated, so you should swap it out with runProguard, like this:
release {
minifyEnabled false //Replaced old line: runProguard false
// ... other code ...
}
Your question will then probably be whether you should set minifyEnabled to true. To answer this question, go ahead and check out my post over here to learn about what minifyEnabled actually does.
Hope it helps!
Harry James
14,780 PointsHarry James
14,780 PointsHey Kevin!
Can you show me your build.gradle file?