expo: Plugin with id ‘maven’ not found.
Summary
I Just upgraded react-native from 0.62.0 to 0.63.0 and all was working fine. But after I integrated expo unimodules in my bare expo project when I try to make the build for android then expo dependencies give me the below error.
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
bare
What platform(s) does this occur on?
Android
SDK Version (managed workflow only)
No response
Environment
React-native : 0.63.0 Expo Unimodules : 0.13.3 Gradle version : 7.0 Project : Typescript
buildToolsVersion = “30.0.0” minSdkVersion = 21 compileSdkVersion = 30 targetSdkVersion = 30
Reproducible demo or steps to reproduce from a blank project
- Integrate it for the bare project after upgrading to 0.63.0 from 0.62.0 .
Error
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/ios/Desktop/Old MacMini Data/Desktop/React Live Projects/afridom/node_modules/expo-constants/android/build.gradle' line: 2
* What went wrong:
A problem occurred evaluating project ':expo-constants'.
> Plugin with id 'maven' not found.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo-constants'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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 12s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 22
- Comments: 33 (12 by maintainers)
Links to this issue
Commits related to this issue
- [packages] replace maven plugin with maven-publish plugin (#16080) # Why the `maven` plugin is deprecated in gradle 7 and the `maven-publish` plugin is the replacement. fix #12774 # How -... — committed to expo/expo by Kudo 2 years ago
- [packages] replace maven plugin with maven-publish plugin (#16080) the `maven` plugin is deprecated in gradle 7 and the `maven-publish` plugin is the replacement. fix #12774 - replace `maven` plugi... — committed to expo/expo by Kudo 2 years ago
- [packages] replace maven plugin with maven-publish plugin (#16080) # Why the `maven` plugin is deprecated in gradle 7 and the `maven-publish` plugin is the replacement. fix #12774 # How -... — committed to prakashbask/expo by Kudo 2 years ago
android studio 4.2 with gradle 7.0.1 gives below error
downgraded gradle-6.8.1-all.zip in gradle-wrapper.properties … working good
Temporary workaround:
For any expo package, go to its
android/build.gradleand modify to usemaven-publishplugin:I stumbled here via google search and just wanted to let you guys know that the ‘maven’ plugin was deprecated in gradle 7. The suggested replacement is maven-publish. I belive the previous plugin had a bit different purpose. I could be wrong, though.
For those using gradle 7, maven plugin has been removed, now you should use maven-publish, as described in official site at this link: https://docs.gradle.org/7.0/userguide/upgrading_version_6.html?_ga=2.21245883.1883799052.1624281891-1948725710.1624281891#removal_of_the_legacy_maven_plugin So, instead of using:
apply plugin: 'maven'you should useapply plugin: 'maven-publish'To summarise for those running into this issue:
Change gradle build tools in the main build.gralde to:
classpath 'com.android.tools.build:gradle:4.2.2'Change distribution url in the yourproject/gradle/wrapper/gradle-wrapper.properties file to:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zipThe jump between the 7.0 version and the versions mentioned above is so huge because they are aligning the version numbers with the Gradle version number. The versions mentioned above just before the 7.0 versions.
Hi @brentvatne thanks for your suggestion. à The problem actually was with the Gradle version. I just had to downgrade my Gradle version to version 6.4.1 using sdk-manager while following this guide
then,
gradle wrappercommand workedThis results in a number of No signature of method errors for certain react native packages.
No signature of method: build_1pnz21phoowefc22xejnoeuib.android() is applicable for argument types: (build_1pnz21phoowefc22xejnoeuib$_run_closure1) values: [build_1pnz21phoowefc22xejnoeuib$_run_closure1@23db40cd]Anyone facing this?
+1 for gradle 7 support
What’s the plan for supporting Gradle 7? Now that React Native supports it.
Android Studio Artic Fox is promoting to upgrade to Gradle 7+. Almost everyone who is using the bare workflow with the latest Android Studio will get this issue. Mirgating to “maven-publish” will save a lot of hassle for developers who haven’t had this issue yet. Is this migration very complex?
For anyone who wants this temporary fix (please read the code yourself), I made a quick fix file with the examples here and from the replace-in-files node module. I realize that it is sloppy, but it should get everything for an upgrade. I had missed the publications part in my initial run, so I haven’t tested it with that.
After installing gradle6.4.1 using sdk manager and setting gradle wrapper
I have used your method. I have used sdk manager and downgrade my gradle to 6.4.1 but my android studio artic fox supports only gradle 7.0 and my react-native modules do not support gradle 7.0. I am using macbook pro m1 chip. The error which i am getting is this:
Minimum supported Gradle version is 7.0.2. Current version is 6.4.1.
Please help me out on the same.
Good - I think that’s the only way to go for the moment