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!

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

Problems with Android Studio

Hello everyone,

I'm following the series Android Tools, I installed it on my Windows 7 64 bit machine, and i get the following errors:

  1. Project SDK is not defined
  2. Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.

Thanks for all your help. @benjakuben

7 Answers

For the SDK you will have to tell IntelliJ to locate your Android SDK, by directing to the installed directory. When starting IntelliJ thus Android studio it will first ask you to define the JAVA SDK and the Android SDK. If no then you can always direct it to the directory in the preferences section of Android Studio

As for the Gradle error I found this solution from Stack Overflow 1) File -> Invalidate caches / Restart

2) Shutdown Android Studio

3) Rename/remove .gradle folder in the user home directory

4) Restart Android Studio let it download all the Gradle stuff it needs

5) Gradle build success !

Rebuild project.... and success !

Hope this helps

Hello Gunjeet, thanks for your response.

I tried all that you have suggested. The Project SDK is not defined doesn't show up anymore. But when i click on Build > Rebuild Project i get this error:

Failed to complete Gradle execution.

Cause: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.10.userguide/gradle_daemon.html

Any help?

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Can you paste the contents of your Gradle file at app/src/build.gradle?

Also, a bugfix update to Android Studio has been released. In Android Studio, go to Help > Check for Update to download and install the small update. That may fix your problem.

Hi Sir Ben.

Here's the app/src/build.gradle:

```apply plugin: 'com.android.application'

android { compileSdkVersion 'android-L' buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.example.unknown.myapplication"
    minSdkVersion 15
    targetSdkVersion 'L'
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

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

Also, I have already updated to the latest version, still the same errors.

Thank you very much for taking the time helping me.

I have the exact same problem with the gradle thing. Nothing seems to help

Hi Ozgur, yeah. it seems that i'm not the only one then.

So i uninstalled Android Studio because i think it's still buggy yet. And went back to eclipse, but now when i run Android SDK Manager in Eclipse, it just shows the loading screen but it doesn't really load, i've waited for several minutes, still didn't show up.

Now i can't make any android apps now. Any help?

Seems like our teacher Ben Jakuben is busy these past few days. Well, i hope we get some help here.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Hey everyone, sorry for your trouble here! I'm currently trying to recreate/troubleshoot your issue. I'll pop back in here soon.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

I am unable to reproduce this error or find much information online. I'd suggest trying Android Studio again. You can try this updated bundle, which I'll be using in my soon-to-be-released refresh of Build a Simple Android App: Android Studio bundle

Hi there Ben, I have no more problem now. I don't know how but tried many things and the problem is gone now. Thank you though

can't download the file. AccessDeniedAccess DeniedFA831AADE7463E874GAwLdmx2JXY6OlqWNDgZt5/PMzgUaaZmzFktJPRWcS/dIFH53W4OVPTf/fa2UIG

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Sorry, I missed that the upload was still in process. Should be ready in a few minutes.

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 35,075 Points

Did anyone figure this out? I was building the Signals from Mars project last night, was almost done and first the emulator would not run the program, then, after I shut everything down, rebooted the computer and opened Studio again I got the GRADLE PROJECT SYNC FAILED message described above and the message Error:C:\Users\Nancy "Melucci.gradle\caches\2.4\scripts\settings_cpusi84x110iewf29aoeswpfv\SettingsScript\buildscript\cache.properties (The system cannot find the file specified)" I tried to invalidate the cache and restart and the error is still there. I was really hoping to finish this without purging the app and starting from scratch but if that's what it takes....I don't want this to happen again, even if it does, so if anyone knows how to make this error message go away, I'd appreciate the help - Thanks very much. Nancy M.