react-native-share: Build is failing due to jcenter dependency disappearing

Our build has been failing since yesterday and pointing the finger at react-native-share

* What went wrong:
A problem occurred configuring project ':react-native-share'.
> Could not resolve all files for configuration ':react-native-share:classpath'.
   > Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

It looks like this dependency has disappeared from bintray, though the .pom file is still in the folder https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/

https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

{
  "errors" : [ {
    "status" : 404,
    "message" : "Could not find resource"
  } ]
}

I realise this is likely to be an upstream issue, but am hoping that someone here has an idea what we can do to fix this, since it’s coming through react-native-share?

Environment

  • React Native version: 0.53.3
  • React Native platform + platform version: Android build
  • Gradle version: 4.4

react-native-share

Version: 1.1.2

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I mean the build.graddle of react-native-share:

node_modules/react-native-share/android/build.graddle

Yes @jgcmarins

I can confirm that the branch is working

If bintray isn’t carrying the android support libraries for some reason, there’s nothing gradle (the android build/package tool) can do if you don’t provide it a way to resolve the dependency somehow. It’s as if npmjs.org decided to delete react-native-share, what can we do? Point it to somewhere that has it.

Who has this dependency guaranteed? The google repo. So somewhere the google repo isn’t in the resolution path, and must be added (preferably first - they’re more reliable than most…)

Adding the google repository is either via ‘google()’ in modern gradle versions or the

maven {
            url "https://maven.google.com/"
        }

…stanza in older gradles (you don’t need both - it’s just that it didn’t get a first-class name of google() until gradle 4.1) is going to be what resolves it

You’ll need to add it in the “main project” that defines the gradle build - so then the question is where. Looks to me like this module has a valid pointer to google’s maven repo in react-native-share 1.1.2:

https://github.com/mikehardy/react-native-share/blob/83a3ec5e7bbc77f6681f0a96779692ba9a0e283e/android/build.gradle

If you want to check to see if the code in master will work, regardless, you can alter the react-native-share dependency in you package.json as a test to "git+https://github.com/react-native-community/react-native-share.git" and run an npm install - that’s how you ask npm (or yarn) to pull github master of any dependency, as opposed to using release packages.

I don’t see a difference between the current release and master though so I think this dependency problem might be elsewhere?

+1

Adding google() on build.graddle fix the issue:

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}

Also I have notice that the code on master is different, maybe there are a pending release?

Thank you very much @mikehardy

Also I have noticed that with the current order (with jcenter() first) and upgrading the graddle version it works: com.android.tools.build:gradle:3.1.3

So we can conclude that is an issue related to version 3.1.2 and jcenter() dependency