Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with react-native-hms-location in React Native 0.77.0 #361

Open
teracityyazilim opened this issue Feb 13, 2025 · 1 comment
Open

Comments

@teracityyazilim
Copy link

I am experiencing an issue when building my React Native application using @hmscore/react-native-hms-location (6.12.0-302). The build process fails with the following error:

A problem was found with the configuration of task ':react-native-hms-location:packageDebugResources' (type 'MergeResources').

  • Gradle detected a problem with the following location: 'D:\Litera\Yedek\BilimpMobilV4\node_modules@hmscore\react-native-hms-location\android\build\generated\res\resValues\debug'.

    Reason: Task ':react-native-hms-location:packageDebugResources' uses this output of task ':hmscore_react-native-hms-location:generateDebugResValues' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

    Possible solutions:

    1. Declare task ':hmscore_react-native-hms-location:generateDebugResValues' as an input of ':react-native-hms-location:packageDebugResources'.

    2. Declare an explicit dependency on ':hmscore_react-native-hms-location:generateDebugResValues' from ':react-native-hms-location:packageDebugResources' using Task#dependsOn.

    3. Declare an explicit dependency on ':hmscore_react-native-hms-location:generateDebugResValues' from ':react-native-hms-location:packageDebugResources' using Task#mustRunAfter.

    React: 18.3.1
    React Native: 0.77.0
    HMS Location SDK: @hmscore/react-native-hms-location 6.12.0-302
    Build Tools Version: 35.0.0
    minSdkVersion: 24
    compileSdkVersion: 35
    targetSdkVersion: 34
    ndkVersion: 27.1.12297006
    kotlinVersion: 2.0.21

It appears that the packageDebugResources task is missing a dependency declaration on generateDebugResValues, which is causing a build issue due to task execution order.

@teracityyazilim
Copy link
Author

I wrote the problem on Huawei forums and it was solved. I tried both solutions below separately. Both are working.
I added it as a bug and solution for those who have the same problem.

Huawei Support Team's Response

We will recommend that you try the steps below regarding the error you are encountering.

  1. First, modify your android/app/build.gradle with the following changes:

android {
// Existing configurations...

tasks.whenTaskAdded { task ->
    if (task.name == 'packageDebugResources') {
        task.dependsOn(':hmscore_react-native-hms-location:generateDebugResValues')
    }
}

}

dependencies {
// Existing dependencies...
implementation project(':@hmscore_react-native-hms-location')
}

  1. If the above solution doesn't work, try modifying your

include ':@hmscore_react-native-hms-location'
project(':@hmscore_react-native-hms-location').projectDir = new File(rootProject.projectDir, '../node_modules/@hmscore/react-native-hms-location/android')

gradle.beforeProject { project ->
if (project.name == 'react-native-hms-location') {
project.tasks.whenTaskAdded { task ->
if (task.name == 'packageDebugResources') {
task.dependsOn(':hmscore_react-native-hms-location:generateDebugResValues')
}
}
}
}

  1. Clean your project and rebuild:
    cd android

./gradlew clean

  1. Additional checks:

    Verify that your android/gradle/wrapper/gradle-wrapper.properties is using a compatible Gradle version (7.5.1 or higher recommended for your setup)
    Ensure your android/build.gradle includes the HMS Maven repository:

buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://developer.huawei.com/repo/' }
}
}

Have a nice day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant