无法使用Gradle构建Android应用程序,但使用sudo除外

我正在尝试使用gradle构建一个简单的’hello world’安卓应用程序.如果我发出命令它会建立好

sudo ./gradlew build –> builds fine

但没有sudo,

./gradlew build –> shows following error

FAILURE: Build Failed with an exception.

* What went wrong:
A problem occurred configuring project ':MyStudioApplication'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':MyStudioApplication:_DebugCompile'.
      > Could not find any version that matches com.android.support:appcompat-v7:+.
        required by:
            workspace:MyStudioApplication:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD Failed

Total time: 12.621 secs

以下是我的build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsversion "19.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
}

请帮忙

最佳答案
在这里黑暗中拍摄,您可能已经使用sudo运行初始gradle构建,这可能导致工件被下载并且被打包为root并且普通用户无法访问.要测试此假设,您可能需要重命名本地存储库,其中gradle下载依赖项并重新运行gradle作为标准用户.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...