HMS-Core / hms-react-native-plugin

This repo contains all of React-Native HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
241 stars 68 forks source link

HMS won't accept apply in .gradle file in react-version 0.74.1 #335

Closed mahermalhem closed 2 months ago

mahermalhem commented 4 months ago

Description i am trying to impl this pkg and it's features for sending notifications https://www.npmjs.com/package/@hmscore/react-native-hms-push?activeTab=versions

on RN-V 0.74.1 and each time i write apply plugin: "com.huawei.agconnect"

it wont sync

After i tried manual installation

ryskin commented 4 months ago

same, please help

itsmeshusha commented 3 months ago

Have anybody solution?

mahermalhem commented 3 months ago

Not yet guys no one knows

omarabualhija commented 2 months ago

now it is working with me on0.74.2

what i did !

first one download the library

yarn add @hmscore/react-native-hms-push

you can use 6.12.0-301 or 6.12.0-300 there is no difference between them. see

android/build.gradle

inside repositories block add

maven { url 'https://developer.huawei.com/repo/' }.

and in dependencies add

classpath 'com.huawei.agconnect:agcp:1.9.1.300'

and at the bottom of the file add

      allprojects {
  repositories {
          google()
        mavenCentral()
    maven { url 'https://developer.huawei.com/repo/' }
  }
}

apply plugin: "com.huawei.agconnect"

your file should be like this

Screenshot 2024-07-06 at 9 56 48 AM

android/settings.gradle. add

include ':react-native-hms-push' project(':react-native-hms-push').projectDir = new File(rootProject.projectDir, '../node_modules/@hmscore/react-native-hms-push/android')

Screenshot 2024-07-06 at 9 58 48 AM

finally in android/app/build.gradle. inside dependencies add

implementation "com.huawei.hms:push:6.12.0.300"

Screenshot 2024-07-06 at 10 00 24 AM

then run your app on android studio
it should works fine !

mahermalhem commented 2 months ago

@omarabualhija Thanks, everything went good and worked now even on 0.74.1

don't know what the issue was exactly, i had done same implementaion on the days i was working on also i have samll comment on setting.gradle file always put the

include ':react-native-hms-push' project(':react-native-hms-push').projectDir = new File(rootProject.projectDir, '../node_modules/@hmscore/react-native-hms-push/android')

before the

apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

Closed ...