为什么我在尝试构建我签名的APK时遇到错误

时间:2015-07-13 18:32:27

标签: android android-studio

我只是想创建一个已签名的APK并在线查看 THIS 教程。我完全按照教程中的所有步骤操作,但我仍然在messages选项卡中收到以下错误。

错误:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.android.support:appcompat-v7:22.2.0.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
         https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
         file:/C:/Users/Silambu/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
         file:/C:/Users/Silambu/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
         file:/C:/Users/Silambu/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
         file:/C:/Users/Silambu/AppData/Local/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
     Required by:
         Droidone:app:unspecified

如果我没有生成签名的APK,android工作室不会构建我的项目并运行它,所以我真的需要构建一个签名的APK。那么为什么我会收到此错误,我该如何解决?

编辑:构建gradle文件。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.gautam.droidone"
        minSdkVersion 8
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
//        testPackageName "com.example.gautam.droidone.tests.MainActivityTest"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
}

其他gradle文件:

// 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:1.2.3'

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

allprojects {
    repositories {
        jcenter()
    }
}

0 个答案:

没有答案