./gradlew assembleRelease BUILD FAILED with Could not find com.linkedin.dexmaker:dexmaker:2.21.0

Viewed 668

It's a react-native project with expo bare workflow.
./gradlew assembleDebug works normally and I'm able to run the app.

However ./gradlew assembleRelease build fails with the following output:

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 is not listed in package.json dependencies so it must be a child dependency of one of the packages.
Adding jcenter() to android/build.gradle doesn't fix the issue.

Any ideas which package may use expo-json-utils or how to get rid of this issue?

2 Answers

Addidng jcenter() to the settings.gradle solved the issue:

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

There were 2 problems.

  1. Expo and related packages were updated recently and these lines were still in 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"

They should be removed.

  1. Still need to add jcenter() to android/build.gradle file's section:
allprojects {
    repositories {

Looks like only the latest version 2.28.1 is added to maven central: https://mvnrepository.com/artifact/com.linkedin.dexmaker/dexmaker-mockito

Older versions are in jcenter and transitive dependency version from expo-json-utils@0.2.0 is 2.21.0

Related