DEV Community

Aashutosh Poudel
Aashutosh Poudel

Posted on

Fix "Could not find maven()" error in expo

I didn't have any issues building a development version of the app using expo. While running npx expo run:android I encountered an issue that something like this: "Could not find maven() for arguments ....".

The issue seems to be related to @rnmapbox/maps.
To resolve the issue make sure to add the following maven configs inside repositories in android/build.gradle.

repositories {

        maven {
            url 'https://maven.google.com/'
        }

        maven {
          url 'https://api.mapbox.com/downloads/v2/releases/maven'
          authentication { basic(BasicAuthentication) }
          credentials {
            username = 'mapbox'
            password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
          }
        }
}
Enter fullscreen mode Exit fullscreen mode

Versions:
Managed, config plugins + expo-dev-client

{
  // ...
  "expo": "~47.0.8",
  "react-native": "0.70.5",
  // ...
}
Enter fullscreen mode Exit fullscreen mode

References:

  1. Android Build Failure | Could not find method maven()
  2. Could not find method maven()
  3. RN 0.66 Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0

Top comments (0)