从今天开始,由于这个错误,我无法构建我的android项目:
> Could not resolve all files for configuration ':classpath'.
> Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar
Android Studio 3.2.1 com.android.tools.build:gradle:3.0.1
您有任何线索吗??? 非常感谢
弗拉德
答案 0 :(得分:4)
我在cordova-android@7.1.1项目中遇到了同样的问题。我读了这个问题Android Studio - Could not find intellij-core.jar,并加入了多个答案来解决。
前提:
解决方案:
文件: platforms / android / build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
...
文件: platforms / android / app / build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
...
文件: platforms / android / CordovaLib / build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
...
此解决方案对我有用,希望我能对您有所帮助
答案 1 :(得分:0)
我遇到了同样的问题,请改用classpath 'com.android.tools.build:gradle:3.1.0'
解决我的问题。你可以试试看。
答案 2 :(得分:0)
此答案很大程度上基于离子文章:https://ionic.zendesk.com/hc/en-us/articles/360005529314
此脚本可以添加到挂钩中,因此无需手动摆弄平台代码。
使用以下内容创建一个maven_swap.sh
:
#!/bin/bash
#remove jcenter
sed -i.bak '/jcenter()/d' platforms/android/CordovaLib/build.gradle
#append jcenter
sed -i.bak '/maven {/{
N
N
a\
jcenter()
}' platforms/android/CordovaLib/build.gradle
cat platforms/android/CordovaLib/build.gradle
rm platforms/android/CordovaLib/build.gradle.bak
注意:sed -i.bak
确保Linux和Mac的兼容性。
确保文件可执行chmod +x maven_swap.sh
在config.xml
中添加以下内容:
<platform name="android">
<hook src="maven_swap.sh" type="before_compile" />
...
</platform>