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

Whitney Barber
Whitney Barber
9,453 Points

Android Studio still won't run my Fun Facts project.

Initially when I attempted to open the project the app gave this error message... !Error (17,0) Gradle DSL method not found 'runProguard()' The project FunFacts may be using a version of gradle that does not contain the method. Gradle settings The build file may be missing a gradle plugin Apply gradle plugins

After changing runProguard to minifyEnabled I got this error message,

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

Here’s the build.gradle file...

apply plugin: 'com.android.application'
android {
    compileSdkVersion 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.whitn_000.funfacts"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
         apply plugin: 'java'
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

OK - so that's shoing one buld failed at 7:58 due to the java plugin then two separate builds completing at 08:07:16 and 08:07:31.

That looks as though the build worked?

Are you getting these messages from the Gradle Console or Event Log?

Runtime errors are better detected with the Logcat which, in my installation, is under number 6: Android.

Whitney Barber
Whitney Barber
9,453 Points

I'm getting this message from the event log. I'm not sure how useful this is but I believe this all began when windows sent an update through.

6 Answers

L B
L B
28,323 Points

Try doing:

Build > Rebuild Project

Whitney Barber
Whitney Barber
9,453 Points

Thanks for answering. I tried doing a rebuild and got this message... Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins.

I had a look at my gradle file and that doesn't include the line you're having trouble with.

So, if you try the advice above, then try File | Invalidate Caches/Restart. You may then want to try removing the line apply plugin: 'java' just to see if that helps.

Steve.

Whitney Barber
Whitney Barber
9,453 Points

Thanks fr the suggestion. I gave it a shot and got hi message... 7:43:08 PM Gradle sync started 7:44:11 PM Gradle sync failed: The 'java' plugin has been applied, but it is not compatible with the Android plugins. Consult IDE log for more details (Help | Show Log) So then I put the java plug in back and removed apply plugin: 'com.android.application', this was the result... Error:Missing Android platform(s) detected: 'android-19' install.android.platform">Install missing platform(s) and sync project

Hi there,

Everything I read in Stack Overflow seems to point to not requiring the java plugin. Checking my apps, it isn't included in any of those, either.

In your comment you're saying you get the message "THe 'java' plugin has been applied" even when you've removed that line in gradle? Can you remove the java plugin again, save the file, and then post the whole error message in here please?

Whitney Barber
Whitney Barber
9,453 Points

I removed apply plugin: 'java' , saved then attempted a rebuild. This is the full event log...

7:58:10 PM Gradle sync started 7:59:12 PM Gradle sync failed: The 'java' plugin has been applied, but it is not compatible with the Android plugins. Consult IDE log for more details (Help | Show Log) 8:06:55 PM Executing tasks: [clean, :app:compileDebugSources, :app:compileDebugAndroidTestSources] 8:07:16 PM Gradle build finished in 21s 824ms 8:07:16 PM Gradle sync started 8:07:31 PM Android SDK Tools Version 24.0.2 is available. Install Tools 24.0.2 8:07:31 PM Gradle sync completed

Hi Whitney,

The post you last made showed that the Gradle build completed: "Gradle sync completed" - what error are you getting as your posts impliend that the buld is working. Is there a runtime error too?

If you could take some screen shots, that might help get to the bottom of this.

Also, if you have a Github or Bitbucket account, post the link to the repository here, and I can see if I can replicate the issue here.

Same for Boston Laine - what errors are you getting?

Steve.

As Whitney said above, I think the line runProguard false needs amending to minifyEnabled false.

That should allow your Gradle to sync.

I'll do some more research on the plugin thing - I can't see that you've got that line of code in your file, which I think is correct, so I must wonder if you have the right JDK installed? Do you know what version you are running?

Once you've changed the code above, will your build complete like Whitney's seems to? Do you get errors in the Logcat rather than the Gradle log?

Steve.

Whitney Barber
Whitney Barber
9,453 Points

Unfortunately I don't understand how repositories work. I've setup github and bitbucket accounts. But I have no idea how to create links so that you can work with my project, please assist?

Boston Laine
Boston Laine
685 Points

What's going on Whitney, I wanted to know if you ever found the problem to why the app didn't start, because I am having the same issue when I applied the update that was sent out and now everything has been going wrong? Please let me know if you have found a resolution.

Thank You

Whitney Barber
Whitney Barber
9,453 Points

Hi Boston, sorry to hear you're having the same problem. Sadly I've not been able to recover my project. I've downloaded the instructor's project file but can't get it to run either. If I find a solution I'll post it here.

Boston Laine
Boston Laine
685 Points

Okay cool thank you Whitney!!!

Hello Steve Hunter the errors I am getting are "the java plugin has been applied; but it doesn't apply to the version" it is something in that manner that I am receiving the error message. Also, here is another issue that I am running into:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.bostonsportsmobileapp.bostonsportfacts"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}