【发布时间】:2019-03-29 00:40:17
【问题描述】:
我正在尝试在 Android Studio 中同步一个 React-Native 项目,每当我尝试同步它时,它都会引发如下错误,
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.jaa r
对于 Cordova 和其他项目的同一问题,我尝试了很多前面提到的方法,但我看不到它对我的 React-Native 有效。
我的 build.gradle 文件如下所示
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
}
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
重复问题的答案看起来像 Cordova,但我的问题是关于 React-Native,我尝试了所有的答案,没有一个不起作用
【问题讨论】:
-
您应该针对与您的编译和支持相同的 API 版本。
-
@TheWanderer,没有得到你,你能详细说明一下吗?
-
在使用 API 27 进行编译并使用 API 27 支持库版本时,您不应以 API 26 为目标。
-
那么targetSdkVersion应该是27?
-
是的。应该是的。
标签: android android-studio react-native android-gradle-plugin