越来越摇篮建立出错科尔多瓦项目摇篮、科尔、多瓦、项目

2023-09-08 09:53:30 作者:痛彻心扉

我刚刚更新科尔多瓦的版本从4.0到5.1,一切都还创建项目运行良好。但只要我给了科尔多瓦构建命令我得到了下面的错误。

I just updated cordova version from 4.0 to 5.1, and everything worked fine also in creating project. But as soon as I gave command of cordova build I got below error.

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/co
m/android/tools/build/gradle/maven-metadata.xml.
            > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/bu
ild/gradle/maven-metadata.xml'.
               > peer not authenticated

经过2天的痛苦我才知道它的到来,由于摇篮,我下载并添加它也是环境变量。我得到这个错误还当我去到Android文件夹科尔多瓦项目,并给出了摇篮的init 命令。不知道是什么不当,可能它。我还在使用Eclipse,而不是机器人工作室可以把它也可以是理由吗?

After 2 days suffering I came to know it's coming due to gradle, I downloaded and added it also in environment variable. I do get this error also when I go to android folder in cordova project and give command of gradle init. Don't know what can be reason of it. Am still using eclipse instead of android studio can it also be a reason ?

推荐答案

确定愚蠢的答案,previously我用科尔多瓦4.0和eclipse这是使用Ant进行构建。

OK silly answer, previously I was using cordova 4.0 and eclipse which was using ant for build.

不过,从科尔多瓦5.0它需要摇篮。我刚安装Android的工作室,并映射我的老SDK下载使用Eclipse。正如我映射,并在机器人工作室开业科尔多瓦创建的项目之一。 我得到了一个错误,但由于这里计算器的问题之一,我解决了问题。

But from cordova 5.0 it requires gradle. I just installed android studio and mapped my old sdk downloaded with eclipse. As I mapped it and opened one of cordova created project in android studio. I got one error but due to one of stackoverflow question here, I solved the issue.

创建新的项目,花了一些时间来下载所有的依赖,但最后它解决。现在我可以创建CMD。

Created new project and it took some time to download all the dependencies, but at last it solved. Now I can create with CMD.

因此,答案的关键是你需要安装Android工作室如果你还在使用eclipse。