hms-react-native-plugin icon indicating copy to clipboard operation
hms-react-native-plugin copied to clipboard

Build breaks with gradle 7.2 (react-native 0.67)

Open peltax opened this issue 2 years ago • 7 comments

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 .

peltax avatar Mar 23 '22 15:03 peltax

Hi @peltax

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

image

Thank You.

ozcanozgur avatar Apr 08 '22 13:04 ozcanozgur

@peltax did you fix the problem

feras-merwas avatar Apr 12 '22 11:04 feras-merwas

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.

peltax avatar Apr 12 '22 13:04 peltax

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

geroale avatar Apr 18 '22 08:04 geroale

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/' }
    }
}

yaroslavnikiforov avatar May 06 '22 07:05 yaroslavnikiforov

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

gregersn avatar May 06 '22 10:05 gregersn

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

topi-identio avatar May 11 '22 11:05 topi-identio

"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.

ozcanozgur avatar Oct 14 '22 08:10 ozcanozgur