【问题标题】:./gradlew assembleRelease BUILD FAILED with Could not find com.linkedin.dexmaker:dexmaker:2.21.0./gradlew assembleRelease BUILD FAILED with Could not find com.linkedin.dexmaker:dexmaker:2.21.0
【发布时间】:2022-06-21 05:06:53
【问题描述】:

这是一个带有 expo 裸工作流的 react-native 项目。
./gradlew assembleDebug 工作正常,我能够运行该应用程序。

但是,./gradlew assembleRelease 构建失败并显示以下输出:

Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':expo-json-utils:debugAndroidTestRuntimeClasspath'.
   > Could not find com.linkedin.dexmaker:dexmaker:2.21.0.
     Searched in the following locations:
       - file:/Users/<MY USERNAME>/.m2/repository/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
       - file:/Users/<MY PROJECT PATH>/node_modules/react-native/android/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
       - file:/Users/<MY PROJECT PATH>/node_modules/jsc-android/dist/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
       - https://dl.google.com/dl/android/maven2/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
       - https://repo.maven.apache.org/maven2/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
       - https://www.jitpack.io/com/linkedin/dexmaker/dexmaker/2.21.0/dexmaker-2.21.0.pom
     Required by:
         project :expo-json-utils > io.mockk:mockk-android:1.10.6 > io.mockk:mockk-agent-android:1.10.6

expo-json-utils 未列在 package.json 依赖项中,因此它必须是其中一个包的子依赖项。
jcenter() 添加到android/build.gradle 并不能解决问题。

有什么想法可以使用expo-json-utils 或者如何解决这个问题?

【问题讨论】:

  • 我假设您已经尝试过,但可能会尝试删除 node_modules 文件夹并运行 npm i --save 以重新安装。很多时候,这为我解决了任何类似的问题。此外,在重新安装包后,在 Android Studio 中清理并重新构建项目,然后运行 ​​assembleRelease 会有所帮助。
  • @AleksandarZoric,是的,我试过了,没有帮助...

标签: android react-native expo release


【解决方案1】:

有 2 个问题。

  1. Expo 和相关包最近更新了,这些行还在android/app/build.gradle
apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle"
apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"

它们应该被删除。

  1. 仍然需要将jcenter() 添加到android/build.gradle 文件的部分:
allprojects {
    repositories {

看起来只有最新版本 2.28.1 被添加到 maven Central: https://mvnrepository.com/artifact/com.linkedin.dexmaker/dexmaker-mockito

旧版本在 jcenter 中,来自expo-json-utils@0.2.0 的传递依赖版本是2.21.0

【讨论】:

  • 我有同样的错误,但我没有任何以“应用自”开头的行。此外,添加 jcenter 并没有解决我的问题
  • 您好,有人解决了这个问题吗?
【解决方案2】:

jcenter() 添加到settings.gradle 解决了这个问题:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        jcenter() // <- this
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 2021-04-20
    • 1970-01-01
    • 2017-03-29
    • 1970-01-01
    相关资源
    最近更新 更多