gpt4 book ai didi

android - 无法在 mac OS 中构建 android 项目

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

我是 phonegap 的新手。我已经为 mac OS 中的所有平台创建了项目。我能够构建除 android 平台以外的平台。我正在使用 cordova 5.1.1 版本。

cordova 构建 android

cordova build android

Running command: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/cordova/build
ANDROID_HOME=/Users/abc/Library/Android/sdk/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/gradlew cdvBuildDebug -b /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/build.gradle -Dorg.gradle.daemon=true
> Configuring > 0/2 projects > root project > Resolving dependencies ':classpath'


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:1.0.0+.
Required by:
:android:unspecified
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml'.
> Malformed reply from SOCKS server

* 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: 5 mins 6.688 secs

/Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)

最佳答案

如果您想使用 maven 本地仓库而不是远程仓库,您需要将 jar 文件添加到本地仓库。

本地maven仓库位于

~/.m2/repository

您可以从这个链接下载它, http://mvnrepository.com/artifact/com.android.tools.build/builder/

要在命令行中安装此库类型:

mvn install:install-file -DgroupId=com.android.tools.build \ -DartifactId=builder \ -Dversion=0.5.4 \ -Dfile=builder-0.5.4.jar \ -Dpackaging=jar \ -DgeneratePom=true

然后在build.gradle文件中修改,

mavenCentral()

mavenLocal()

这可能会有所帮助:)

关于android - 无法在 mac OS 中构建 android 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32863946/

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