Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2)

My React Native build quite suddenly fails with an error, in spite of working just fine a day ago with no changes that appear relevant.

FAILURE: Build failed with an exception.

* What went wrong: A problem occurred configuring project ':react-native-document-scanner'.
> Could not resolve all artifacts for configuration ':react-native-document-scanner: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

Similar questions have been asked several times before, but the usual solution is to add google() to the repositories section. However

  1. Our repositories sections already contain google()
  2. google() already appears ahead of jcenter()

Snippet from build.gradle:

buildscript {
    repositories {
        // ...
        google()
        maven { url 'https://maven.google.com' }
        mavenLocal()
        mavenCentral()
        maven { url "https://jitpack.io" }
        jcenter()
    }
}

// ...

allprojects {
    repositories {
        // ...
        google()
        mavenLocal()
        mavenCentral()
        maven { url "https://jitpack.io" }
        jcenter()
    }
}

It may or may not be relevant, though I certainly find it peculiar, that it looks to me like it successfully downloads the same thing for other dependencies:

$ ls ~/.gradle/caches/modules-2/files-2.1/com.android.tools.lint/lint-gradle-api/26.1.2/*
/home/petter/.gradle/caches/modules-2/files-2.1/com.android.tools.lint/lint-gradle-api/26.1.2/8c54aedfe9da66e64402de04883cee083c127a3b:
lint-gradle-api-26.1.2.jar

/home/petter/.gradle/caches/modules-2/files-2.1/com.android.tools.lint/lint-gradle-api/26.1.2/f68c47a57523ed87b225532b98f2dd2ece9552bb:
lint-gradle-api-26.1.2.pom
like image 496
Petter Häggholm Avatar asked Oct 23 '18 23:10

Petter Häggholm


2 Answers

In my case, it's related with Fabric module,

My imported Fabric module's version was 0.5.2 (also have problem 0.5.1)

I solved this to downgrade Fabric module's version from 0.5.2 to 0.5.0

When build is success then the .jar file is created at .gradle/..

So I can use 0.5.2 version again,

I think it can be related with module's version

like image 94
Minsoo kim Avatar answered Nov 06 '22 08:11

Minsoo kim


Run the following command inside the android folder of your react-native project:

"./gradlew build --refresh-dependencies"

This way you can find which node-module has issue in build.gradle. I found this issue was being caused bu react-native-share module. So I updated the version to 1.1.3 in package.json for react-native-share. The other alternative is to update the build.gradle file inside the /node-modules/react-native-share/android/ and move the google() above jcenter()

like image 1
user2313617 Avatar answered Nov 06 '22 10:11

user2313617