因为今天由于此错误,我无法构建我的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
安卓工作室 3.2.1 com.android.tools.build:gradle:3.0.1
你有什么线索??? 多谢
弗拉德
我在 cordova-android@7.1.1 项目中遇到了同样的问题。我读了这个问题 Android Studio - 找不到智能核心.jar我通过加入多个答案来解决。
前提:
- 安卓工作室 3.2.1
- 科尔多瓦安卓 7.1.1
- 科尔多瓦 CLI 8.1.2
分辨率:
文件: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'
}
}
...
这个解决方案对我有用,希望我能帮到你
我有同样的问题,并更改为classpath 'com.android.tools.build:gradle:3.1.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>