question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android dependency NumberPickerView 1.1.5 only available on deprecated JCenter

See original GitHub issue

Describe the bug Explicit Android dependency on com.henninghall.android:NumberPickerView:1.1.5 which is only available on JCenter (via Maven Central) causes android build failure when jcenter is not included in repository set.

JCenter is scheduled to sunset imminently so this component will no longer be useable after that occurs.

Expected behavior Build should succeed when jcenter is excluded from available repositories.

To Reproduce

  • Create a vanilla RN project.

  • Remove jcenter from android/build.gradle, add other dependencies (mavenCentral, other jcenter-only packages):

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
        ndkVersion = "20.1.5948944"
    }
    repositories {
        google()
        // *** REMOVED THIS ***
        // jcenter()
        // *** ADDED THIS ***
        mavenCentral()
        maven {
          url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.1.0")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        // *** ADDED THIS ***
        mavenCentral()

        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        // *** REMOVED THIS ***
        // jcenter()
        maven { url 'https://www.jitpack.io' }

        // *** ADDED THIS ***
        // as they are not available outside jcenter at any compatible version
        jcenter() {
            content {
                includeModule( "com.facebook.fbjni", "fbjni-java-only" )
                includeModule( "com.facebook.yoga", "proguard-annotations" )
            }
        }
    }
}
  • Override transient dependencies that have compatible versions off jcenter to android/app/build.gradle in the dependencies block:
dependencies {
    // preceding config removed for brevity
    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

    // *** ADDED THIS ***
    implementation("com.facebook.fresco:fresco") {
      version {
        strictly "2.3.0"
      }
      because "not available at 2.2.0 in maven central (transitive was pulled in by react-native:0.64.0)"
    }

    // *** ADDED THIS ***
    implementation("com.facebook.fresco:stetho") {
      version {
        strictly "2.3.0"
      }
      because "not available at 2.2.0 in maven central (transitive was pulled in by flipper-fresco-plugin:0.76.0)"
    }
}
  • Add react-native-date-picker to project
> npx react-native install react-native-date-picker
info Installing "react-native-date-picker"...
yarn add v1.22.4
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "react-native > react-native-codegen > jscodeshift@0.11.0" has unmet peer dependency "@babel/preset-env@^7.1.6".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ react-native-date-picker@3.2.10
info All dependencies
└─ react-native-date-picker@3.2.10
✨  Done in 3.53s.
info Linking "react-native-date-picker"...
warn Calling react-native link [packageName] is deprecated in favor of autolinking. It will be removed in the next major release.
Autolinking documentation: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Linking "react-native-date-picker" iOS dependency
info iOS module "react-native-date-picker" has been successfully linked
info Linking "react-native-date-picker" Android dependency
info Android module "react-native-date-picker" has been successfully linked
success Successfully installed and linked "react-native-date-picker"
  • Attempt to build the android app:
> npx react-native run-android
... snip ...
> Task :app:mergeDebugAssets FAILED
8 actionable tasks: 5 executed, 3 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.henninghall.android:NumberPickerView:1.1.5.
     Searched in the following locations:
       - file:/Users/x/.m2/repository/com/henninghall/android/NumberPickerView/1.1.5/NumberPickerView-1.1.5.pom
       - https://repo.maven.apache.org/maven2/com/henninghall/android/NumberPickerView/1.1.5/NumberPickerView-1.1.5.pom
       - file:/Users/x/dev/minimal-react-native-app/MinimalProject/node_modules/react-native/android/com/henninghall/android/NumberPickerView/1.1.5/NumberPickerView-1.1.5.pom
       - file:/Users/x/dev/minimal-react-native-app/MinimalProject/node_modules/jsc-android/dist/com/henninghall/android/NumberPickerView/1.1.5/NumberPickerView-1.1.5.pom
       - https://dl.google.com/dl/android/maven2/com/henninghall/android/NumberPickerView/1.1.5/NumberPickerView-1.1.5.pom
       - https://www.jitpack.io/com/henninghall/android/NumberPickerView/1.1.5/NumberPickerView-1.1.5.pom
     Required by:
         project :app > project :react-native-date-picker

Smartphone (please complete the following information):

  • OS: Android 11
  • React Native version 0.64.0
  • react-native-date-picker version 3.2.10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
gesangsetocommented, Mar 4, 2022

Please how to solving this? I still get the issue, this my dependencies

"react": "16.13.1",
"react-native": "0.63.4",
"react-native-date-picker": "^4.2.0",
 buildToolsVersion = "28.0.3"
 minSdkVersion = 16
 compileSdkVersion = 28
 targetSdkVersion = 28
 supportLibVersion = "28.0.0"
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.github.henninghall:numberpickerview:v1.1.5.
     Searched in the following locations:
       - file:/C:/Users/PC-MMDS-01/.m2/repository/com/github/henninghall/numberpickerview/v1.1.5/numberpickerview-v1.1.5.pom
       - file:/D:/DATA GESANG/app-mertrack/Eisai/version-2-reborn/frontend_android/node_modules/react-native/android/com/github/henninghall/numberpickerview/v1.1.5/numberpickerview-v1.1.5.pom
       - file:/D:/DATA GESANG/app-mertrack/Eisai/version-2-reborn/frontend_android/node_modules/jsc-android/dist/com/github/henninghall/numberpickerview/v1.1.5/numberpickerview-v1.1.5.pom
       - https://dl.google.com/dl/android/maven2/com/github/henninghall/numberpickerview/v1.1.5/numberpickerview-v1.1.5.pom
       - https://jcenter.bintray.com/com/github/henninghall/numberpickerview/v1.1.5/numberpickerview-v1.1.5.pom
     Required by:
         project :app > project :react-native-date-picker

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
2reactions
OfryLcommented, Apr 14, 2022

@gesangseto dId you find any workaround? @henninghall are you planning to remove jCenter from NumberView(com.github.henninghall:numberpickerview:v1.1.5.)?

Could not find com.github.henninghall:numberpickerview:v1.1.5. Required by: project :react-native-date-picker

JCentre dependancy : https://github.com/henninghall/NumberPickerView/blob/master/build.gradle

Hi @swatiredhu17, i managed to fix this by adding this to repositories:

maven { url 'https://www.jitpack.io' }

ref https://github.com/henninghall/react-native-date-picker/pull/363/files#diff-f642ff4d3d056a27ab1bd906e3054c6b81193ff68ee42a8f57132e4402bba840R22

Read more comments on GitHub >

github_iconTop Results From Across the Web

JCenter deprecation; impact on Gradle and Android
Gradle 7.0 will deprecate the use of jcenter() to resolve dependencies. You will still be able to use JCenter as a repository, but...
Read more >
Upgrade Android Project from JCenter to Maven Central
Android Studio 4.1.2 and AGP (Android Gradle Plugin) still require a version of a dependency (trove4j) that is only on JCenter.
Read more >
JCenter service update - Android Developers
Developers who use dependencies from JCenter will need to find the new location of updated versions of those dependencies. Was this helpful?
Read more >
Many Android/Google/Firebase libraries unpublished from ...
A problem occurred evaluating root project 'android'. > Could not resolve all dependencies for configuration 'classpath'. > Could not find any matches for...
Read more >
Zebra EMDK Setup - TechDocs
EMDK extends Android Studio with tools to interface with and configure Zebra Android ... as a read-only mirror for Java packages, but JCenter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found