prscX / react-native-tooltips

React Native: Native Tooltip View
Apache License 2.0
271 stars 40 forks source link

RN 0.57.4 w/ gradle 4.4 build error #19

Open badaz opened 5 years ago

badaz commented 5 years ago

Hi, first thanks for this module! I'd really love to try it in my project but unfortunately I can't build it after installing / linking / adding the jitpack repo. The error I'm getting is this one :

> Could not resolve all files for configuration ':react-native-tooltips: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

I tried to move the maven { url 'https://jitpack.io' } around in my build.gradle as it can sometimes solve this kind of problem, but it always ends up looking in jcenter... Here is my build.gradle repository config (working prior to installing your package) :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 21
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
    }

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

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven {
            // Local Maven repo containing AARs with JSC library built for Android
            url "$rootDir/../node_modules/jsc-android/dist"
        }
    }
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
        if (details.requested.group == 'com.android.support'
                && !details.requested.name.contains('multidex') ) {
                details.useVersion rootProject.ext.supportLibVersion
            }
        }
    }
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                defaultConfig {
                    targetSdkVersion rootProject.ext.targetSdkVersion
                }
            }
        }
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '4.4'
    distributionUrl = distributionUrl.replace("bin", "all")
}

I also tried removing everything exotic (local maven repos and subprojects section) to check if this was the problem with no luck, still the same error. Since I cannot find any issues referencing this problem I guess it must be quite recent and maybe related to RN 0.57.4? Do you have any info about this?

Thanks again!

geomih commented 5 years ago

I was able to fix this by editing node_modules\react-native-tooltips\android\build.gradle. I added google() and mavenCentral() before jcenter().

badaz commented 5 years ago

Thanks, I'll try that

prscX commented 5 years ago

Thanks @geomih for sharing the solution. Can you please share PR for the same.

Thanks </ Pranav >

geomih commented 5 years ago

Done.

badaz commented 5 years ago

It works now thanks