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

Development Tools

Android studio beta not working.

I recently updated my android studio to the latest beta version. But alas, it can no longer run my files and all i get is an annoying error saying

Gradle 'MyApplication' project refresh failed Error:Cause: error in opening zip file

alt text

Can anyone please help me solve this horror? Thanks in advance.

5 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Is this a new project or an existing one? Can you post the contents of both build.gradle files from your project? MyApplication/build.gradle and MyApplication/app/build.gradle

Projects from the older Android Studio Preview need some Gradle setting updates to work in the beta.

I get that same error on creating a new project or even importing an existing android studio project.

MyApplication/build.gradle contents below

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

MyApplication/app/build.gradle contents below

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.elitehive.codepippen.myapplication"
        minSdkVersion 15
        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'])
}
Ben Jakuben
Ben Jakuben
Treehouse Teacher

If you open the SDK Manager, which version of the "Android SDK Platform Tools" do you have installed? Mine is 20 and I had to update Gradle settings in my existing project like this:

buildToolsVersion "20.0.0"

Ben Jakuben
Ben Jakuben
Treehouse Teacher

For what it's worth, here are my contents of app/build.gradle for a test project:

apply plugin: 'com.android.application'

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

    defaultConfig {
        applicationId "com.benjakuben.testproject"
        minSdkVersion 'L'
        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'])
}

And for an existing project:

apply plugin: 'com.android.application'

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

    defaultConfig {
        applicationId "com.teamtreehouse.crystalballrefresh.app"
        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'])
}

Its funny that I am having the same configurations when i create a new project and for an existing project but I can't run them. I only get that same error.

I have the same problem. I just installed android studio and created a project and receiving this error. Seriously weird

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Can you try this solution from StackOverflow and see if it works? http://stackoverflow.com/a/23839694/475217