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 Build a Simple Android App (2014) Getting Started with Android Setting Up an Android Development Environment for Windows

Brian Maimone
PLUS
Brian Maimone
Courses Plus Student 1,644 Points

Error messages after loading FunFacts project into Android Studio

In the Preview pane I get Rendering Problems: No Android SDK found. Please configure an Android SDK. Across the top menu I get Can't start Git: git.exe, Probably the path to Git executable is not valid. Fix it. Lastly, I have Failed to sync Gradle project 'Fun Facts', Error: failed to find target android-19 : C:\Users\Brian\AppData\Local\Android\sdk, Install misssing platforms and sync project.

4 Answers

Harry James
Harry James
14,780 Points

Hey there Brian!

I'm guessing you got this problem after trying to import a project, you get a lot of errors like this when doing so.


ERROR 1 & 3 FIX

First off, No Android SDK found. Please configure an Android SDK and Failed to sync Gradle project 'Fun Facts', Error: failed to find target android-19

You're getting these errors because the system has not found the Android SDK on your system. Not to worry though, this is a simple fix, all we need to do is go ahead and download it (This may take a while though as there's lots to download!).

To fix this, open up the SDK Manager off the top toolbar:

Next, from the gradle error you got, I can see that the project is looking for the Android SDK API 19 so, go ahead an download this. You'll also need to accept the license agreements for the SDK (I have a few as I haven't been keeping my SDK up to date!):

Once the SDK has downloaded and installed, the error should go away and you should be able to run the project :)


ERROR 2 FIX

Now for the second error, Can't start Git: git.exe, Probably the path to Git executable is not valid. Fix it.. This usually means that the person who you imported the project from was using the Git VCS (Version Control System) but, if you're not using it, you can turn it off.

To do this, go to File >> Settings >> Version Control and make sure that the box is empty (Apart from the < Project > and < none > placeholders):

You may also need to clear the path to Git which you can do under the Git heading (Just make sure the box is blank again):

Then, hopefully the error will go away (You may need to restart Android Studio).

If you are using Git however, you should specify the correct path to your git.exe file under the Git heading shown above and the problem will be fixed.


ALTERNATE FIX TO ERROR 1: Upgrade to API 21

Also, an alternate of downloading API 19 is to download API 21 (It's newer) but update the compileSdkVersion and buildToolsVersion attributes in your build.gradle file (The one in your app directory) as follows:

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

This will make sure that you keep up to date with any new features on Android.


Hope it helps and, if you have any more questions, give me a shout :)

Hi Brian, first thing i would do is to go to the SDK Manager(found in the Toolbar) and check if i have the SDK Platform for Android 4.4.2 API 19 downloaded. Download the latest which is currently SDK Platform 5.1.1, re-open Android studio and Build agian.

Hope this works!

Brian Maimone
PLUS
Brian Maimone
Courses Plus Student 1,644 Points

Well I cleared the path fields in Version Control and Git and I'm still getting the Can't start Git: git.exe error, but I notice red highlighted field saying unregistered Git root: C:\Users\Brian\AndroidStudioProjects\FunFacts\FunFacts Add root, on the Version Control menu.

Now I get Gradle DSL method not found: 'runProguard()' Error(16,0) The project 'FunFacts' may be using a version of Gradle that does not contain the method. Also, the build file may be missing a Gradle plugin. Lastly I see an Unregistered Vcs root detected error in the event log

Harry James
Harry James
14,780 Points

If you've removed all references to Git under the Version Control as shown in my answer above, you should no longer have the git/VCS errors. If you do, try Invalidating Android Studio's caches. To do this, click on the File tab then Invalidate Caches / Restart and press Invalidate and Restart:


As for the Gradle error, I also had this previously and found that it's actually because the proguardEnabled file got renamed to minifyEnabled (Why, I don't know but, oh well).

To fix it, open up your build.gradle file found in your app directory. Then, make this change:

// DELETE THIS LINE: runProguard true/false`. Replace with this \/
minifyEnabled true/false

And pick either true or false. If you don't know what to pick, use false for now:

minifyEnabled false

as we get onto how ProGuard works and what it does in the Publish an Android App Course.


Hope it helps and, if you have any more questions/problems, give me a shout :)

Harry James
Harry James
14,780 Points

Oh, one last thing. If the Unregistered VCS Root is the green prompt message:

You can just press Ignore VCS Root Errors.


I believe this is just when Android Studio detects a .git file in the project directory. It might go away if you delete the .git file from your File Explorer I think (I use git so I can't test whether this works or not):

Either way should work though :)