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

[Error: 907135000: arguments invalid] after upgrading to react-native 0.73.9 #357

Open
sakisev opened this issue Oct 7, 2024 · 0 comments

Comments

@sakisev
Copy link

sakisev commented Oct 7, 2024

Description
I have recently upgraded my project to 0.73.9 and I found that I had to also upgrade hmscore/react-native-hms-push from 6.5.0-300 as it was causing the build to fail. I tried to go with the latest version 6.12.0-302 but although the build is successful the hms-push service doesn't seem to work at all. After debugging the issue i found that the getToken method always seem to exit with this error

Error registering to HMS [Error: 907135000: arguments invalid]

According to my investigation this seemed to be an issue with my configuration, I have removed everything hms related from my project and followed the documentation to make sure I have the absolute latest configurations but I still ended up with the same issue.
I looked into the GitHub issues here and followed a couple more suggestions but none of them seemed to work (#335, #217, #185)
settings.gradle

rootProject.name = <REDACTED>

if (System.getenv("IS_HUAWEI")=="TRUE") {
  include ':react-native-hms-push'
  project(':react-native-hms-push').projectDir = new File(rootProject.projectDir, '../node_modules/@hmscore/react-native-hms-push/android')
}
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); 
applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')


app/android/build.gradle

if (System.getenv("IS_HUAWEI")=="TRUE") {
  apply plugin: "com.huawei.agconnect"
}

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 26
        compileSdkVersion = 34
        targetSdkVersion = 34
        kotlinVersion = "1.8.0"
        ndkVersion = "25.1.8937393"
        androidXBrowser = "1.3.0"
    }
    repositories {
        google()
        mavenCentral()
        if (System.getenv("IS_HUAWEI")=="TRUE") {
          maven { url 'https://developer.huawei.com/repo/' }
        }
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
        if (System.getenv("IS_HUAWEI")=="TRUE") {
          println("Using Huawei push")
          classpath 'com.huawei.agconnect:agcp:1.9.1.300'   //Huawei
        } else {
          println("Using Firebase push")
          classpath 'com.google.gms:google-services:4.4.2'  //firebase
        }
    }
}
apply plugin: "com.facebook.react.rootproject"
allprojects {
    repositories {
        google()
        mavenCentral()
        if (System.getenv("IS_HUAWEI")=="TRUE") {
          maven { url 'https://developer.huawei.com/repo/' }
        }
    }
}

app/android/app/build.gradle

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
react {}
def enableProguardInReleaseBuilds = true
def jscFlavor = 'org.webkit:android-jsc:+'

project.ext.react = [
  enableHermes: true,  // clean and rebuild if changing
]

project.ext.sentryCli = [
  logLevel   : "debug",
  flavorAware: true
]

apply from: "../../node_modules/@sentry/react-native/sentry.gradle"

android {
  ndkVersion rootProject.ext.ndkVersion
  buildToolsVersion rootProject.ext.buildToolsVersion
  compileSdk rootProject.ext.compileSdkVersion

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  namespace <REDACTED>
  defaultConfig {
    applicationId <REDACTED>
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    multiDexEnabled true
    ...
  }

  signingConfigs {
    release {
      if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
        storeFile file(MYAPP_RELEASE_STORE_FILE)
        storePassword System.getenv("KEYSTORE_PASSWORD")
        keyAlias MYAPP_RELEASE_KEY_ALIAS
        keyPassword System.getenv("KEYSTORE_PASSWORD")
      }
      v2SigningEnabled true
      enableV3Signing = true
    }
    debug {
      storeFile file('debug.keystore')
      storePassword 'android'
      keyAlias 'androiddebugkey'
      keyPassword 'android'
      v1SigningEnabled true
      v2SigningEnabled true
      enableV3Signing = true
//      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
  }
  buildTypes {
    debug {
      signingConfig signingConfigs.debug
    }
    release {
      // Caution! In production, you need to generate your own keystore file.
      // see https://reactnative.dev/docs/signed-apk-android.
      debuggable false
      shrinkResources enableProguardInReleaseBuilds
      zipAlignEnabled enableProguardInReleaseBuilds
      minifyEnabled enableProguardInReleaseBuilds
      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
      signingConfig signingConfigs.release
    }
  }
  packagingOptions {
     pickFirst 'lib/x86/libc++_shared.so'
     pickFirst 'lib/x86_64/libjsc.so'
     pickFirst 'lib/arm64-v8a/libjsc.so'
     pickFirst 'lib/arm64-v8a/libc++_shared.so'
     pickFirst 'lib/x86_64/libc++_shared.so'
     pickFirst 'lib/armeabi-v7a/libc++_shared.so'
  }
  flavorDimensions "type"
  productFlavors {
    uat {
      dimension "type"
    }
    production {
      dimension "type"
      applicationId <REDACTED>prod
    }
  }
}

dependencies {
  // The version of react-native is set by the React Native Gradle Plugin
  implementation("com.facebook.react:react-android")
  implementation("com.facebook.react:flipper-integration")

  if (hermesEnabled.toBoolean()) {
    implementation("com.facebook.react:hermes-android")
  } else {
    implementation jscFlavor
  }
  if (System.getenv("IS_HUAWEI")=="TRUE") {
    implementation "com.huawei.hms:push:6.12.0.300"
  }

  implementation 'com.onfido.sdk.capture:onfido-capture-sdk:16.1.0'
  implementation 'com.onfido.sdk.capture:onfido-capture-sdk-core:16.1.0'
  implementation 'androidx.work:work-runtime:2.8.0'
  implementation 'androidx.work:work-runtime-ktx:2.8.0'
  implementation 'com.datatheorem.android.trustkit:trustkit:1.1.3'
  implementation 'androidx.preference:preference-ktx:1.1.1'
  implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.3"))
  // define any required OkHttp artifacts without version
  implementation("com.squareup.okhttp3:okhttp")
  implementation("com.squareup.okhttp3:logging-interceptor")
  implementation("com.appmattus.certificatetransparency:certificatetransparency:2.4.1")
  implementation("com.appmattus.certificatetransparency:certificatetransparency-android:2.4.1")
}

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

// For Firebase
if (System.getenv("IS_HUAWEI") != "TRUE") {
  apply plugin: 'com.google.gms.google-services'
}

Environment

  • Platform: React-Native
  • Kit: Push
  • Kit Version 6.12.0-302
  • OS Version Android 12
  • Android Studio version (if applicable) [e.g. 4.1]
  • Platform version (if applicable)
  • Node Version v18.19.1
  • Your Location/Region (if applicable)
@sakisev sakisev changed the title Error registering to HMS [Error: 907135000: arguments invalid] react-native 0.73.9 [Error: 907135000: arguments invalid] after upgrading to react-native 0.73.9 Oct 8, 2024
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

1 participant