maps: [Android] Autolinking not working

Describe the bug Build failed when I launch react-native run-android

Expected behavior Should build.

Versions :

  • Platfrom: Android
  • Device: Emulator
  • OS: Android 9
  • SDK Version: 28
  • React Native Version 0.60.5
  • react-native-mapbox-gl/maps version: 7.0.6

Additional context

FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve project :@react-native-mapbox-gl_maps.
     Required by:
         project :app
      > Unable to find a matching configuration of project :@react-native-mapbox-gl_maps:
          - None of the consumable configurations have attributes.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 16 (6 by maintainers)

Most upvoted comments

I just try manually linking by adding this in settings.gradle file

include ':@react-native-mapbox-gl_maps'
project(':@react-native-mapbox-gl_maps').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-mapbox-gl/maps/android/rctmgl')

and it works!

It’s a workaround, there is still a bug with the autolinking

@bpouzet thanks a lot. Now I see. Line order in settings.gradle is important. When I put apply from... above include. It starts to work.

@MrScorp thanks for finding this issue. That was a silly typo/oversight from me. Opened a PR and merging this as soon as CI is good.

Turns out the react native configuration file (react-native.config.js) is named as “react-native-config.js” in the package ! Renaming the file fixed autolinking issues for me. But you’ll have to do it everytime you update any package.