gpt4 book ai didi

android - 无法使用 Gradle 构建 Android 应用程序,除了 sudo

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:46:11 25 4
gpt4 key购买 nike

我正在尝试使用 gradle build 运行一个简单的“hello world”android 应用程序。如果我发出命令,它会构建得很好

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 构建,这可能导致 Artifact 被下载并被授予 root 权限,并且您的普通用户无法访问。要测试此假设,您可能需要重命名 gradle 下载依赖项的本地存储库并以标准用户身份重新运行 gradle。

关于android - 无法使用 Gradle 构建 Android 应用程序,除了 sudo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21038012/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com