Search code examples
react-nativereact-native-maps

build fails just after installing react native maps in bare react native app


The app build failed just after I have installed react-native-maps, the error message is like

Task :react-native-maps:processDebugManifest
package="com.rnmaps.maps" found in source AndroidManifest.xml: C:\Users\Dell\ow\node_modules\react-native-maps\android\src\main\AndroidManifest.xml. Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported, and the value is ignored. Recommendation: remove package="com.rnmaps.maps" from the source AndroidManifest.xml: C:\Users\Dell\ow\node_modules\react-native-maps\android\src\main\AndroidManifest.xml.

Task :react-native-maps:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
52 actionable tasks: 12 executed, 40 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':react-native-maps:compileDebugJavaWithJavac'.

Could not resolve all files for configuration ':react-native-maps:androidJdkImage'. Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for JdkImageTransform: C:\Users\Dell\AppData\Local\Android\Sdk\platforms\android-34\core-for-system-modules.jar. > Error while executing process C:\Program Files\Java\jdk-21\bin\jlink.exe with arguments {--module-path C:\Users\Dell.gradle\caches\transforms-3\393400499b2af28f59d755a5f301569b\transformed\output\temp\jmod --add-modules java.base --output C:\Users\Dell.gradle\caches\transforms-3\393400499b2af28f59d755a5f301569b\transformed\output\jdkImage --disable-plugin system-modules}

  • Try:

Run with --stacktrace option to get the stack trace.> Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.

BUILD FAILED in 54s error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-maps:compileDebugJavaWithJavac'. > Could not resolve all files for configuration ':react-native-maps:androidJdkImage'. > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for JdkImageTransform: C:\Users\Dell\AppData\Local\Android\Sdk\platforms\android-34\core-for-system-modules.jar. > Error while executing process C:\Program Files\Java\jdk-21\bin\jlink.exe with arguments {--module-path C:\Users\Dell.gradle\caches\transforms-3\393400499b2af28f59d755a5f301569b\transformed\output\temp\jmod --add-modules java.base --output C:\Users\Dell.gradle\caches\transforms-3\393400499b2af28f59d755a5f301569b\transformed\output\jdkImage --disable-plugin system-modules} * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 54s. info Run CLI with --verbose flag for more details.

The app build failed just after I have installed react-native-maps, i have the latest jdk-21, set the path of JAVA_HOME in environment variables. The app has a home screen and a details screen to navigate, on the details page i am trying to implement maps and even before writing any code with maps the build fails which was successful just before the install of react-native-maps. I have fetched google maps api too and set to go, but this error keeps happening. i tried to uninstall the react-native-maps and then build again, then it's successful, so it's puzzling a bit.


Solution

  • I think issue is with your Gradle Version which is not compatible. Kindly update classpath and compile sdk version as:

    buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 21
        compileSdkVersion = 34
        targetSdkVersion = 34
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.6.0'
    }
    }
    

    or update gradlew version through terminal,

    cd android ./gradlew wrapper --gradle-version=8.6.0
    

    after that run ./gradlew clean

    also install latest version of maps

    npm install react-native-maps@latest
    

    then run build, if problem still persist kindly share your react-native version and gradlew version also maps version. Happy Coding!