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 Android Data Persistence File Storage Reading from Internal Storage

Anthony Lau
Anthony Lau
1,898 Points

gradle project sync always failed, i have installed sdk 19, 20 as the hints

I have the lastest version of android studio

2 Answers

I think like me, you'd also have the build tools ver 22 installed. Just change your build.gradle(app) to the one I am pasting here. Major changes are:-

  1. compileSdkVersion 22

  2. buildToolsVersion '22.0.1'

  3. targetSdkVersion 22

  4. minifyEnabled false (Resolvs the ProGuard() error)

  5. compile 'com.android.support:support-v13:22.0.+'

apply plugin: 'android'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'
    defaultConfig {
        applicationId 'com.teamtreehouse.mememaker'
        minSdkVersion 16
        targetSdkVersion 22
        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:22.0.+'
}
Luke Liem
Luke Liem
6,367 Points

The Starter Files provided by Treehouse in this case is generated with Version 0.8.6. So if you are using a newer version of Android Studio (Version 1.0 and above), you need to read the following blog:

http://www.goprogramming.space/importing-older-android-studio-code-example-projects-into-android-studio-1-1-0-step-by-step-guide/

It is a step-by-step guide for importing projects created by older Android Studio versions:

"People started making Android Apps with Android Studio 2 years ago when the first Pre-Developer-Not-At-All-Ready-Version was released.

The developing process of Android Studio took about 1 1/2 years before the first 1.0 version was finished. In this time, many things have changed all the time. Developers made apps during the whole time with a bunch of different versions of Android Studio.

Many of this Source Code examples have never been updated and most of them are not compatible with the recent version of Android Studio....."