Android Build Failure | Could not find method maven()

Currently on a managed workflow.
eas-cli v. 0.52.0
"expo": "^45.0.0"

We’re currently seeing failures for our Android builds that seem to be a due to an issue with Maven. This is from our Run gradlew log:

Running 'gradlew :app:assembleRelease' in /home/expo/workingdir/build/android
Downloading https://services.gradle.org/distributions/gradle-7.3.3-all.zip
10%.
20%.
30%.
40%.
50%.
60%.
70%.
80%.
90%.
100%
Welcome to Gradle 7.3.3!
Here are the highlights of this release:
 - Easily declare new test suites in Java projects
 - Support for Java 17
 - Support for Scala 3
For more details see https://docs.gradle.org/7.3.3/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.3.3/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
> Task :react-native-gradle-plugin:compileKotlin
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.
> Task :react-native-gradle-plugin:pluginDescriptors
> Task :react-native-gradle-plugin:processResources
> Task :react-native-gradle-plugin:compileKotlin
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (10, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (119, 30): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (135, 26): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (155, 32): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (161, 31): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (169, 36): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt: (100, 48): 'reactRoot: DirectoryProperty' is deprecated. reactRoot was confusing and has been replace with rootto point to your root project and reactNativeDir to point to the folder of the react-native NPM package
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (10, 37): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (11, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (12, 37): 'LibraryVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (28, 51): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (131, 12): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (132, 12): 'LibraryVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (252, 14): 'BaseVariant' is deprecated. Deprecated in Java
> Task :react-native-gradle-plugin:compileJava
[stderr] Note: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java uses or overrides a deprecated API.
[stderr] Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-gradle-plugin:classes
> Task :react-native-gradle-plugin:inspectClassesForKotlinIC
> Task :react-native-gradle-plugin:jar
> Configure project :app
Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version. Class name for the included build object: org.gradle.composite.internal.DefaultIncludedBuild$IncludedBuildImpl_Decorated.
[stderr] FAILURE: Build failed with an exception.
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/android/build.gradle' line: 43
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':app'.
[stderr] > Failed to apply plugin class 'org.gradle.api.plugins.BasePlugin'.
[stderr]    > Could not find method maven() for arguments [build_a4pmw2504rhdm3lg68kv7pbd1$_run_closure1$_closure2$_closure4@27c8d403] on configuration ':app:archives' of type org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 1m 59s
6 actionable tasks: 6 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Same issue here:

   > Failed to apply plugin class 'org.gradle.api.plugins.BasePlugin'.
   > Could not find method maven() for arguments [build_ivb93fa0t8x2y0bn4z21xwpp$_run_closure1$_closure4$_closure6@14eb028a] on configuration ':app:archives' of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurat

can you both try building from a commit that was previously successful and, if it fails also, please share a link to both build pages? thank you!

You got it, boss. Here is a new build off the latest passing commit (from Friday morning). Suffice it to say, it failed.

Have updated eas-cli to 2.6.0 and still getting the same failure.

The problem appears to be coming from rnmapbox/maps. We have removed the dependency and commented out all the relevant references and builds are now passing.

1 Like

Ah, we’re using the same library. Damnit, it’s core to our app. I’ll see if any older rnmapbox commits work.

We’re attempting a stopgap fix with "@rnmapbox/maps": "^10.0.0-beta.56" and some patch-package work to deal with the ts errors. It’s sloppy work, but will make for a stopgap while we implement a lasting fix.

1 Like

One of our engineers has made PR on that package repo that fixes the problem (has been merged). We’re relying on patch-package while we wait on the release.

1 Like

I’m encountering this issue as well, with “@rnmapbox/maps”: “^10.0.0-beta.58”, a release which appears to include the PR that fixes this for @relasine. I haven’t dug into this yet to determine what gradle changes are needed, but it seems the fix may not work for all cases. How did you narrow this down to “@rnmapbox/maps”, just a process of elimination by commenting out native dependencies?

We were able to narrow it down by luck and happenstance. There was another dev that we encountered on Stack Overflow that was having the same maven issue during build and they also happened to have @rnmapbox/maps in their dependency list. We have had chronic issues with Mapbox in the past so it suddenly became clear to us that it was a real possibility that Mapbox was the problem. We commented Mapbox out of our app and it built fine after that.

Thanks! I’m following you along that same path.

Currently looking at pivoting to react-native-maps with the Google Maps SDK, but it is just bananas confirming cost. It appears to be free but I’m hearing all sorts of contradictory messages on this.