Cordova 构建 - 无法解析 com.android.tools.build:gradle:1.5.0
Cordova build - Could not resolve com.android.tools.build:gradle:1.5.0
升级我机器的 cordova 和 npm 后 (Ubuntu 15.10) 我无法使用 cordova 构建新项目。 build 指责 gradle 出错。
我做了一些研究并找到了一些可能的解决方案。更改版本和 url gradle repo 等解决方案。反正没用。
我正在使用 cordova 6.0.0 和 npm 1.4.21。
下面是新的 cordova 应用程序安装命令:
soufraz@atlantis:~/Projects/apps$ cordova create test com.somename.test Test
Creating a new cordova project.
soufraz@atlantis:~/Projects/apps$ cd test/
soufraz@atlantis:~/Projects/apps/test$ cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.somename.test
Name: Test
Activity: MainActivity
Android target: android-23
Android project created with cordova-android@5.1.0
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
soufraz@atlantis:~/Projects/apps/test$ cordova build
ANDROID_HOME=/home/soufraz/Install/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
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.5.0.
Required by:
:android:unspecified
> Failure initializing default system SSL context
* 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: 0.769 secs
ERROR building one of the platforms: Error code 1 for command: /home/soufraz/Projects/apps/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/soufraz/Projects/apps/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /home/soufraz/Projects/apps/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/soufraz/Projects/apps/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
额外信息:
- 我安装了所有 android api 19 - 24。
- cordova build android -- --ant
也行不通
- 我用 java jdk 1.7 和 1.8
测试过它
- 所有尝试--stacktrace/--debug/--info: pastebin.com/nD6GNkbR
check_reqs(通过评论询问):
soufraz@atlantis:~/Projects/apps/test/platforms/android/cordova$ ./check_reqs
ANDROID_HOME=/home/soufraz/Install/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Looks like your environment fully supports cordova-android development!
java-版本:
openjdk version "1.8.0_66-internal"
OpenJDK Runtime Environment (build 1.8.0_66-internal-b17)
OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode)
当您尝试更新您的 SKD 或 cordova 而没有其他版本时,就会发生这种情况,然后,版本可能不兼容(并非在所有情况下,但会发生)。
然后,尝试手动更新您的 Android SDK 版本和您的 cordova 到最新版本。
如果您使用的是终端,可以使用命令:android update sdk --no-ui --filter extra
但我的建议是更新您的 Android SDK
在寻找解决方案将近两周后,我发现了一个很好的问题,并且有一个真正的答案解决了这个问题!
来源:Peer not authenticated while importing Gradle project in eclipse
复制原始答案
如果您收到类似这样的任何其他错误:
Could not GET 'https://some_server.com/some/path/some.pom'.
> peer not authenticated
然后需要导入证书:
- 在您喜欢的浏览器中打开“https://some_server.com/some/path/some.pom”
- 使用 Steps to export cert from a web site
导出证书
- 将 cer 复制到
JDK_HOME/jre/lib/security
文件夹
- 打开 shell 并转到
JDK_HOME/jre/lib/security
文件夹
- 然后使用
将cer导入java
keytool -import -alias <the short name of the server> -file <cert_file_name_you_exported.cer> -keystore cacerts -storepass changeit
它会提示你导入证书,输入yes然后回车。
然后重新启动 eclipse 并尝试构建项目。
升级我机器的 cordova 和 npm 后 (Ubuntu 15.10) 我无法使用 cordova 构建新项目。 build 指责 gradle 出错。
我做了一些研究并找到了一些可能的解决方案。更改版本和 url gradle repo 等解决方案。反正没用。
我正在使用 cordova 6.0.0 和 npm 1.4.21。
下面是新的 cordova 应用程序安装命令:
soufraz@atlantis:~/Projects/apps$ cordova create test com.somename.test Test
Creating a new cordova project.
soufraz@atlantis:~/Projects/apps$ cd test/
soufraz@atlantis:~/Projects/apps/test$ cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.somename.test
Name: Test
Activity: MainActivity
Android target: android-23
Android project created with cordova-android@5.1.0
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
soufraz@atlantis:~/Projects/apps/test$ cordova build
ANDROID_HOME=/home/soufraz/Install/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
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.5.0.
Required by:
:android:unspecified
> Failure initializing default system SSL context
* 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: 0.769 secs
ERROR building one of the platforms: Error code 1 for command: /home/soufraz/Projects/apps/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/soufraz/Projects/apps/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /home/soufraz/Projects/apps/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/soufraz/Projects/apps/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
额外信息:
- 我安装了所有 android api 19 - 24。
- cordova build android -- --ant
也行不通
- 我用 java jdk 1.7 和 1.8
测试过它
- 所有尝试--stacktrace/--debug/--info: pastebin.com/nD6GNkbR
check_reqs(通过评论询问):
soufraz@atlantis:~/Projects/apps/test/platforms/android/cordova$ ./check_reqs
ANDROID_HOME=/home/soufraz/Install/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Looks like your environment fully supports cordova-android development!
java-版本:
openjdk version "1.8.0_66-internal"
OpenJDK Runtime Environment (build 1.8.0_66-internal-b17)
OpenJDK 64-Bit Server VM (build 25.66-b17, mixed mode)
当您尝试更新您的 SKD 或 cordova 而没有其他版本时,就会发生这种情况,然后,版本可能不兼容(并非在所有情况下,但会发生)。 然后,尝试手动更新您的 Android SDK 版本和您的 cordova 到最新版本。
如果您使用的是终端,可以使用命令:android update sdk --no-ui --filter extra
但我的建议是更新您的 Android SDK
在寻找解决方案将近两周后,我发现了一个很好的问题,并且有一个真正的答案解决了这个问题!
来源:Peer not authenticated while importing Gradle project in eclipse
复制原始答案
如果您收到类似这样的任何其他错误:
Could not GET 'https://some_server.com/some/path/some.pom'.
> peer not authenticated
然后需要导入证书:
- 在您喜欢的浏览器中打开“https://some_server.com/some/path/some.pom”
- 使用 Steps to export cert from a web site 导出证书
- 将 cer 复制到
JDK_HOME/jre/lib/security
文件夹 - 打开 shell 并转到
JDK_HOME/jre/lib/security
文件夹 - 然后使用 将cer导入java
keytool -import -alias <the short name of the server> -file <cert_file_name_you_exported.cer> -keystore cacerts -storepass changeit
它会提示你导入证书,输入yes然后回车。
然后重新启动 eclipse 并尝试构建项目。