Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
654 views
in Technique[技术] by (71.8m points)

android - gradle, Could not expand ZIP appcompat-v7:19.0.1

I have a problem with Android Studio and Gradle to import appcompat-v7.

So here is my src/build.gradle:

apply plugin: 'android'
apply plugin: 'android-apt'
def AAVersion = '3.0.1'

    android {
        compileSdkVersion 19
        buildToolsVersion "19.0.1"
    
        defaultConfig {
            minSdkVersion 10
            targetSdkVersion 19
            versionCode 1
            versionName "1.0"
            packageName "com.test"
        }
        buildTypes {
            release {
                runProguard false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    }
    
    apt {
        arguments {
            resourcePackageName android.defaultConfig.packageName
            androidManifestFile variant.processResources.manifestFile
        }
    }
    
    dependencies {
    
        // You must install or update the Support Repository through the SDK manager to use this dependency.
        // The Support Repository (separate from the corresponding library) can be found in the Extras category.
        compile 'com.android.support:support-v4:19.0.1'
    
        // You must install or update the Support Repository through the SDK manager to use this dependency.
        // The Support Repository (separate from the corresponding library) can be found in the Extras category.
        compile 'com.android.support:appcompat-v7:19.0.1'
    
        // android annotations
        compile "org.androidannotations:androidannotations-api:$AAVersion"
        apt "org.androidannotations:androidannotations:$AAVersion"
    }

But I get the following error:

Execution failed for task ':app:prepareComAndroidSupportAppcompatV71901Library'.
> Could not expand ZIP '/opt/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/19.0.1/appcompat-v7-19.0.1.aar'.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It seems the issue is with directories permissions .

Check and try following things :

  • Check whether you have write access on both the android sdk and Android Studio directories.
  • if you are on Windows OS, also try to run Android Studio as Administrator by right clicking on the Studio's icon, .

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...