【发布时间】:2020-04-27 16:09:24
【问题描述】:
我注意到这是构建应用程序时的常见问题。每次我尝试构建我的项目时,我都会收到此错误,但所有级别的 build.gradle 都与另一个项目相同,该项目的构建没有任何问题。我已经尝试以多种方式将存储库放在另一个之上,但它不起作用。我还尝试按照某些论坛的建议从 2 个不同的 Internet 连接下载,但没有运气。这是错误:
> Task :app:preDebugBuild FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.squareup.okhttp3:okhttp:^4.2.2.
Required by:
project :app
请记住,以下规范与其他正在完美构建的项目相同。
Ionic:
Ionic CLI : 6.6.0 (C:\Users\joelf\AppData\Roaming\nvm\v12.11.1\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 4.11.8
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.1.2
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : not available
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 14 other plugins)
Utility:
cordova-res : 0.12.2
native-run : 0.3.0
System:
Android SDK Tools : 26.1.1 (C:\Users\joelf\AppData\Local\Android\Sdk\)
NodeJS : v12.11.1 (C:\Program Files\nodejs\node.exe)
npm : 6.11.3
OS : Windows 10
我的 gradle.build 文件看起来像这样:
-
build.gradle在应用程序级别:https://www.codepile.net/raw/4gq79YX7.groovy -
build.gradle在平台/android 级别:https://www.codepile.net/raw/5qVDX28b.groovy -
build.gradle在 CordovaLib 级别:https://www.codepile.net/raw/GRwprwZ1.groovy
如果您需要任何其他文件,请告诉我,这是我第一次使用 gradle、ionic 和 cordova,所以我有点迷失在这里,任何帮助将不胜感激,在此先感谢。
【问题讨论】:
-
能否请您添加您的构建 gradle 应用级别
-
它实际上列出了完整代码的链接,我将其输入错误为 'gradle.build' 而不是 'build.gradle' 哈哈抱歉,但我刚刚编辑过它就在那里。
标签: android cordova ionic-framework gradle