【问题标题】:Could not find intellij-core.jar in React Native在 React Native 中找不到 intellij-core.jar
【发布时间】: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


【解决方案1】:

jcenter 昨天好像坏了。在您的build.gradle 文件中,将jcenter() 移动到google() 下方(两个位置)。

更多信息: https://github.com/facebook/react-native/issues/21907#issuecomment-432319128

【讨论】:

    【解决方案2】:

    在 android/CordovaLib/build.gradle 下进行此特定更改

    repositories {maven {
    url "https://maven.google.com"} jcenter()}
    

    注意:在maven后面加上jcenter(),使用cordova platform add android@7.1.1添加platfrom

    【讨论】:

      猜你喜欢
      • 2019-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-31
      • 1970-01-01
      • 1970-01-01
      • 2023-01-14
      • 1970-01-01
      相关资源
      最近更新 更多