react-native-background-geolocation: Could not find com.huawei.hms:location:6.9.0.300.

Your Environment

  • Plugin version:4.12.1
  • Platform: Android
  • OS version:
  • Device manufacturer / model:
  • React Native version (react-native -v):0.68.2
  • Plugin config
PASTE_YOUR_CODE_HERE

Expected Behavior

Actual Behavior

Not able to get the app run in debug mode.

Steps to Reproduce

  1. went through all the installation instructions exactly as described.

Context

Debug logs

BUILD FAILED in 21s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ‘:app:processDebugResources’.

Could not resolve all task dependencies for configuration ‘:app:debugRuntimeClasspath’. Could not find com.huawei.hms:location:6.9.0.300. Searched in the following locations: - file:/Users/sridhar/fabklean/mobileapps/apps/fabkleanDriver/node_modules/react-native/android/com/huawei/hms/location/6.9.0.300/location-6.9.0.300.pom - file:/Users/sridhar/fabklean/mobileapps/apps/fabkleanDriver/node_modules/jsc-android/dist/com/huawei/hms/location/6.9.0.300/location-6.9.0.300.pom - file:/Users/sridhar/fabklean/mobileapps/apps/fabkleanDriver/node_modules/react-native-background-geolocation/android/libs/com/huawei/hms/location/6.9.0.300/location-6.9.0.300.pom - file:/Users/sridhar/fabklean/mobileapps/apps/fabkleanDriver/node_modules/react-native-background-fetch/android/libs/com/huawei/hms/location/6.9.0.300/location-6.9.0.300.pom - https://repo.maven.apache.org/maven2/com/huawei/hms/location/6.9.0.300/location-6.9.0.300.pom - https://dl.google.com/dl/android/maven2/com/huawei/hms/location/6.9.0.300/location-6.9.0.300.pom - https://jcenter.bintray.com/com/huawei/hms/location/6.9.0.300/location-6.9.0.300.pom - https://www.jitpack.io/com/huawei/hms/location/6.9.0.300/location-6.9.0.300.pom Required by: project :app > project :react-native-background-geolocation

My build.gradle look like import org.apache.tools.ant.taskdefs.condition.Os

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

buildscript { ext { buildToolsVersion = “31.0.0” minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 appCompatVersion = “1.4.2” googlePlayServicesLocationVersion = “20.0.0”

    if (System.properties['os.arch'] == "aarch64") {
        // For M1 Users we need to use the NDK 24 which added support for aarch64
        ndkVersion = "24.0.8215888"
    } else {
        // Otherwise we default to the side-by-side NDK version from AGP.
        ndkVersion = "21.4.7075529"
    }
}
repositories {
    google()
    mavenCentral()
    jcenter()
}

dependencies {
    classpath("com.android.tools.build:gradle:7.0.4")
    classpath("com.facebook.react:react-native-gradle-plugin")
    classpath("de.undercouch:gradle-download-task:4.1.2")
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

def REACT_NATIVE_VERSION = new File([‘node’, ‘–print’,“JSON.parse(require(‘fs’).readFileSync(require.resolve(‘react-native/package.json’), ‘utf-8’)).version”].execute(null, rootDir).text.trim())

allprojects {

configurations.all {
    resolutionStrategy {
        force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
    }
}
repositories {
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url("$rootDir/../node_modules/react-native/android")
    }
    maven {
        // Android JSC is installed from npm
        url("$rootDir/../node_modules/jsc-android/dist")
    }
    maven {
        url("${project(':react-native-background-geolocation').projectDir}/libs")
    }
    maven {
        url("${project(':react-native-background-fetch').projectDir}/libs")
    }
    mavenCentral {
        // We don't want to fetch react-native from Maven Central as there are
        // older versions over there.
        content {
            excludeGroup "com.facebook.react"
        }
    }
    google()
    jcenter()
    maven { url 'https://www.jitpack.io' }
}

}

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

Thanks. The Android Setup Instructions will be updated to require adding the maven url.

allprojects {
    repositories {
         .
         .
         .
+       maven {url 'https://developer.huawei.com/repo/'}
    }
} 

This maven repo is now required for newer gradle versions. It will be added to the plug-in Setup Instructions.

I can’t test the functionality in debug mode because of the above popup as the emulator goes into freeze mode and I can’t do anything after that. Why is that strange error is coming even though the device is not huawei device

Stuck now. Can’t move further. Please help.

Thank you Christocracy for your comment.

Why am I getting that even through I am installing in the android emulator nexus 30 device. Nothing to do with Huwaie. That too after installing react-native-background-geolocation. Screenshot 2023-05-24 at 11 21 54 AM

Above error is gone if I include maven { url ‘https://developer.huawei.com/repo/’ } in the allProjects.repositories section in build.gradle. Where as I am getting a popup after my app got opened once the react-native-background lcoation is initialized. - “some features in app may not work properly without HMS core which is not installed on your device”.

Its not huwaei device, this error should not come at all.