React-native-background-geolocation: Dependency Compilation error - Please assist.

Created on 15 Jul 2018  路  4Comments  路  Source: mauron85/react-native-background-geolocation

Opening project in Android Studio gives errors,

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :react-native-mauron85-background-geolocation-common.
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :react-native-mauron85-background-geolocation-common.
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :react-native-mauron85-background-geolocation-common.
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :react-native-mauron85-background-geolocation-common.
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :react-native-mauron85-background-geolocation-common.
Open File
Show Details


Your Environment


Context


May be linking bug library is unable to find some folders

Expected Behavior


It should work without errors.

Actual Behavior


Giving compilation errors as mentioned above.

Possible Fix


It must work, as its straight forward process but I must be doing something stupid. Please assist.

Steps to Reproduce


  1. Created new project using
    react-native init AwesomeProject
  2. Install plugin using
    yarn add [email protected]
  3. Link project using
    react-native link react-native-mauron85-background-geolocation

Context

Debug logs

All 4 comments

Hi,

I think it's a problem of configuring versions in files build.gradle

See the example project here:
https://github.com/mauron85/react-native-background-geolocation-example/tree/master/android

For example in my project, this is my file build.gradle (/android/build.gradle) :

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

ext {
    buildToolsVersion = "26.0.1"
    minSdkVersion = 16
    compileSdkVersion = 26
    targetSdkVersion = 26
    supportLibVersion = "26.0.1"
}

I tell you this because before it was returns this error to me, then after fixing the versions I solved.

@Richi2293 Thanks for the heads up. It works according to your changes, if I change dependencies classpath to

classpath 'com.android.tools.build:gradle:2.2.3'

but in one of the my other dependencies I need gradle 3.1.3 support and when I change class path to

classpath 'com.android.tools.build:gradle:3.1.3'

It gives above errors, is there any fix I can make this to work with 3.1.3 version ?

@anishroff I'm having the same issue using gradle 3.1.3 and was able to get it building using a temporary fix. I say temporary because I haven't had time to look into why just yet but it compiles for me.

First thing was that I added the last line in this block in my main gradle file
ext {
compileSdkVersion = 26
targetSdkVersion = 26
buildToolsVersion = "27.0.3"
supportLibVersion = "27.1.0"
googlePlayServicesVersion = "11.8.0"
gradle3EXPERIMENTAL = "yes" // ADD THIS LINE
}

After that I received a strange error that the property 'android' couldn't be found for ":app".
There is a function called getApplicationId in VERSIONS.gradle in the react-native-mauron85-background-gelocation-common library, and line 10 that attempts to set the applicationId to project(':app').android.defaultConfig.applicationId is causing the problem.
For now I commented out that if block and just set the application id manually.

It compiles and I'm able to pull location data, so hopefully this will help with fixing the issue properly, again this is only a temp fix to get it compiling with the gradle plugin version 3.1.3.

@mauron85 Thanks a lot for such a wonderful library. After struggle I was able to link the library and its working fine as expected.

@Richi2293 @basudz Thanks guys, its because of you I got this up and running.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

canerd7u picture canerd7u  路  7Comments

mikailbayram picture mikailbayram  路  4Comments

arochedy picture arochedy  路  5Comments

HaswinVidanage picture HaswinVidanage  路  3Comments

pewh picture pewh  路  6Comments