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
May be linking bug library is unable to find some folders
It should work without errors.
Giving compilation errors as mentioned above.
It must work, as its straight forward process but I must be doing something stupid. Please assist.
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.