我正在尝试使用gradle build运行一个简单的'hello world'安卓应用。如果我发出命令
,它就构建得很好sudo ./gradlew build - >建立良好
但没有sudo,
./ gradlew build - >显示以下错误
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:+'
}
请帮忙
答案 0 :(得分:4)
在这里黑暗中拍摄,您可能已经使用sudo运行初始gradle构建,这可能导致工件被下载并且被打包为root并且普通用户无法访问。要测试此假设,您可能需要重命名本地存储库,其中gradle下载依赖项并重新运行gradle作为标准用户。
答案 1 :(得分:0)
如果你得到类似的"无法解析符号" appcompatactivity但运行sudo解决问题,尝试删除/ home目录中的.AndroidStudio文件夹