我正在尝试在 Windows 7 中使用 Ionic CLI 编译我的 Ionic 项目 Android 平台。这是以前有用的东西,现在不行了。唯一改变的是我升级了 Android Studio。但是,我没有使用 Android Studio 进行编译,所以我很惊讶我收到 Gradle 错误。对于:
$ ionic run android
输出是:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApk'.
> A problem occurred configuring project ':CordovaLib'.
> Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
> Could not find com.android.tools.build:gradle:2.2.3.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
Required by:
android:CordovaLib:unspecified
虽然输出声称我可以使用 --stacktrace 和 --debug 标志获得额外的错误信息,但这是不正确的。
我看到线程表明问题是 build 中的存储库列表中缺少一个或多个
。这些都存在。mavenCentral()
或 jcenter()
.gradle
我尝试只向地址发送 HTTP GET,结果返回 404。是否有其他地方可以指示 Gradle 查找这些文件?
可能最奇怪的是,它声称找不到的文件实际上每次都会下载到 Gradle 缓存中(如果我清除它们,它们会在我下次执行命令时出现)。它们出现在:
~/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle/2.2.3/88b4934c958cfe74ff5559c1a33707a562af59d2/gradle-2.2.3.pom
和
~/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle/2.2.3/7b8f79621d95e3ce1e95c0852db14d9d7e1d1951/gradle-2.2.3.jar
到目前为止我采取的步骤:
- 升级 Gradle
- 清除 gradle 和 Maven 存储库
- 在公司内部网关闭并打开
--no-proxy
标志 试试看
我不确定下一个故障排除步骤应该是什么。
最佳答案
我在 mac 上遇到了同样的问题,对我有用的是全新安装的 android studio 和 ionic。 所以可能首先卸载所有东西,然后安装 android studio 更新它安装所需的任何工具,安装 gradle 然后安装 cordova 和 ionic。
关于android - ionic Gradle 故障 "Could not find com.android.tools.build:gradle:2.2.3",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41559784/