我无法构建cordova应用。在下面您可以看到堆栈跟踪:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.ow2.asm:asm-analysis:6.0.
Required by:
project : > com.android.tools.build:gradle:3.2.0
> Could not resolve org.ow2.asm:asm-analysis:6.0.
> Could not get resource 'https://maven.google.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Could not HEAD 'https://maven.google.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Socket closed
> Could not resolve org.ow2.asm:asm-analysis:6.0.
> Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Could not HEAD 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Socket closed
有人有什么想法吗?我没有被防火墙阻止,也没有代理。我找不到任何有助于指出这些依赖项无法解决的资源。
任何帮助将不胜感激。谢谢。
编辑:我尝试过清理科尔多瓦,并且遇到类似的问题,只是一个不同的程序包开始了错误堆栈跟踪:
$ cordova clean
Android Studio project detected
ANDROID_HOME=/Users/[my user folder]/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not download gradle-api.jar (com.android.tools.build:gradle-api:3.2.0)
> Could not get resource 'https://maven.google.com/com/android/tools/build/gradle-api/3.2.0/gradle-api-3.2.0.jar'.
> Could not HEAD 'https://maven.google.com/com/android/tools/build/gradle-api/3.2.0/gradle-api-3.2.0.jar'.
> Socket closed
> Could not download sdklib.jar (com.android.tools:sdklib:26.2.0)
> Could not get resource 'https://maven.google.com/com/android/tools/sdklib/26.2.0/sdklib-26.2.0.jar'.
> Could not HEAD 'https://maven.google.com/com/android/tools/sdklib/26.2.0/sdklib-26.2.0.jar'.
> Socket closed
> Could not download repository.jar (com.android.tools:repository:26.2.0)
> Could not get resource 'https://maven.google.com/com/android/tools/repository/26.2.0/repository-26.2.0.jar'.
> Could not HEAD 'https://maven.google.com/com/android/tools/repository/26.2.0/repository-26.2.0.jar'.
> Socket closed
> Could not download jetifier-processor.jar (com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10)
> Could not get resource 'https://maven.google.com/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10/jetifier-processor-1.0.0-alpha10.jar'.
> Could not HEAD 'https://maven.google.com/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10/jetifier-processor-1.0.0-alpha10.jar'.
> Socket closed
答案 0 :(得分:0)
我找到了解决问题的方法。
我正在运行的cordova应用程序的gradle版本位于gradle版本3.0.1上,该版本期望ndk在其中具有特定的文件夹,该文件夹提供了一些不推荐使用的工具。此堆栈溢出中的答案可解决该问题:Error: No toolchains found in the NDK toolchains folder for ABI with prefix: llvm
此外,gradle文件中的repo行需要更新以包含google()才能找到所有依赖项,从而使其包括以下所有内容:
mavenCentral()
google()
jcenter()
之后,该项目就很好了。可能需要更新gradle版本,这样我就不必使不推荐使用的东西起作用。 :/