Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build breaks with gradle 7.2 (react-native 0.67) #179

Closed
peltax opened this issue Mar 23, 2022 · 8 comments
Closed

Build breaks with gradle 7.2 (react-native 0.67) #179

peltax opened this issue Mar 23, 2022 · 8 comments

Comments

@peltax
Copy link

peltax commented Mar 23, 2022

Description
maven plugin in build.gradle should be changed to use maven-publish plugin.

Expected behavior
Build succeeds

Current behavior
Build failed

Logs
FAILURE: Build failed with an exception.

Build file '.../node_modules/@hmscore/react-native-hms-availability/android/build.gradle' line: 2

  • What went wrong:
    A problem occurred evaluating project ':hmscore_react-native-hms-availability'.

Plugin with id 'maven' not found.

Environment
Newest HMS react native sdk (availability, location, map), react native 0.67 which uses gradle wrapper 7.2 .

@ozcanozgur
Copy link
Collaborator

Hi @peltax

You can try to upgrade agcp version from build.gradle under the android folder.

image

Thank You.

@feras-merwas
Copy link

@peltax did you fix the problem

@peltax
Copy link
Author

peltax commented Apr 12, 2022

I opted to use react-native-device-info to get hms availability instead of this lib as it was already in use. One less native dependency.

@geroale
Copy link

geroale commented Apr 18, 2022

Same issue here. Now we are using react-native-device-info too.

@yaroslavnikiforov
Copy link

I have the same issue with:
"react-native": "0.67.1",
"@hmscore/react-native-hms-account": "^6.1.0-302",
"@hmscore/react-native-hms-availability": "^5.2.0-300",

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Build file '/***/app/node_modules/@hmscore/react-native-hms-account/android/build.gradle' line: 2

* What went wrong:
A problem occurred evaluating project ':hmscore_react-native-hms-account'.
> Plugin with id 'maven' not found.

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
        googlePlayServicesAuthVersion = "19.2.0"
        supportLibVersion = "28.0.0"
        kotlinVersion = '1.5.0'
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://developer.huawei.com/repo/' }
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.3.5'
        classpath("com.android.tools.build:gradle:4.2.2")
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        classpath 'com.huawei.agconnect:agcp:1.6.3.300'
    }
}

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }
        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
        maven {
            // expo-camera bundles a custom com.google.android:cameraview
            url "$rootDir/../node_modules/expo-camera/android/maven"
        }
        maven { url 'https://developer.huawei.com/repo/' }
    }
}

@gregersn
Copy link

gregersn commented May 6, 2022

This same problem occurs with react-native-hms-map

@topi-identio
Copy link

topi-identio commented May 11, 2022

Any update for this? We're using react-native-hms-location for which I just created a simple patch using patch-package that changes the 'maven' plugin to 'maven-publish', which seems to be enough to get it working with RN 0.67:

diff --git a/node_modules/@hmscore/react-native-hms-location/android/build.gradle b/node_modules/@hmscore/react-native-hms-location/android/build.gradle
index 8216db6..324bddc 100644
--- a/node_modules/@hmscore/react-native-hms-location/android/build.gradle
+++ b/node_modules/@hmscore/react-native-hms-location/android/build.gradle
@@ -11,7 +11,7 @@ buildscript {
 }
 
 apply plugin: 'com.android.library'
-apply plugin: 'maven'
+apply plugin: 'maven-publish'
 
 android {
     compileSdkVersion 29

@ozcanozgur
Copy link
Collaborator

"maven-publish" issue has been resolved with the latest versions of Availability, Location and Map plugins. You can find it at npm.

React Native Availability Plugin (6.7.0-300)
React Native Location Plugin (6.4.0-301)
React Native Map Plugin (6.3.1-305)

Thank you for your interest in our plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants