ondato / ondato-sdk-react-native

MIT License
2 stars 5 forks source link

Expo + Android build problem #10

Open b4rtt opened 3 weeks ago

b4rtt commented 3 weeks ago

Hello,

We are trying to integrate Ondato into our React Native application at our company, but it seems to be incompatible with the latest version of Expo and React Native.

The issue appears to be specific to Android. iOS is working fine. The application cannot be launched via yarn android, nor can it be successfully built. I am attaching the error log and a link to the repository where the issue can be reproduced. It's a basic React Native Expo project with only the Ondato plugin added.

Expo: ~51.0.28 React-native: 0.74.5 Ondato: 2.5.6

Example project

`> Task :ondato-sdk-react-native:processDebugManifest package="com.ondatosdkreactnative" found in source AndroidManifest.xml: /Users/roman/Desktop/ondato-test/node_modules/ondato-sdk-react-native/android/src/main/AndroidManifest.xml. Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported, and the value is ignored. Recommendation: remove package="com.ondatosdkreactnative" from the source AndroidManifest.xml: /Users/roman/Desktop/ondato-test/node_modules/ondato-sdk-react-native/android/src/main/AndroidManifest.xml.

Task :app:processDebugMainManifest /Users/roman/Desktop/ondato-test/android/app/src/debug/AndroidManifest.xml:6:5-162 Warning: application@android:usesCleartextTraffic was tagged at AndroidManifest.xml:6 to replace other declarations but no other declaration present /Users/roman/Desktop/ondato-test/android/app/src/debug/AndroidManifest.xml Warning: provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:0 to replace other declarations but no other declaration present

Task :ondato-sdk-react-native:compileDebugKotlin e: file:///Users/roman/Desktop/ondato-test/node_modules/ondato-sdk-react-native/android/src/main/java/com/ondatosdkreactnative/OSRNFragment.kt:68:14 Unresolved reference: init e: file:///Users/roman/Desktop/ondato-test/node_modules/ondato-sdk-react-native/android/src/main/java/com/ondatosdkreactnative/OSRNFragment.kt:76:14 Unresolved reference: startIdentification

Task :ondato-sdk-react-native:compileDebugKotlin FAILED

FAILURE: Build failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1m 43s 317 actionable tasks: 117 executed, 200 from cache Error: /Users/roman/Desktop/ondato-test/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a,armeabi-v7a exited with non-zero code: 1 Error: /Users/roman/Desktop/ondato-test/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a,armeabi-v7a exited with non-zero code: 1 at ChildProcess.completionListener (/Users/roman/Desktop/ondato-test/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23) at Object.onceWrapper (node:events:629:26) at ChildProcess.emit (node:events:514:28) at maybeClose (node:internal/child_process:1105:16) at ChildProcess._handle.onexit (node:internal/child_process:305:5) ... at spawnAsync (/Users/roman/Desktop/ondato-test/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23) at spawnGradleAsync (/Users/roman/Desktop/ondato-test/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:96:48) at assembleAsync (/Users/roman/Desktop/ondato-test/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:74:18) at runAndroidAsync (/Users/roman/Desktop/ondato-test/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:45:37) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

esipavicius commented 3 weeks ago

@Svaike

I have found some fixes:

Open file node_modules/ondato-sdk-react-native/android/src/main/java/com/ondatosdkreactnative/OSRNFragment.kt Change from Ondato.init(config) to Ondato.INSTANCE.init(config) Change from Ondato.startIdentification( to Ondato.INSTANCE.startIdentification(

After this I got error for duplications. Open file node_modules/ondato-sdk-react-native/android/build.gradle In android { I added line:

     configurations.all {
         exclude group: 'org.bouncycastle'
     }

After this my app runs, but crash:

No static method bind(Lkotlin/Pair;Lkotlin/reflect/KClass;)Lkotlin/Pair; in class Lorg/koin/dsl/DefinitionBindingKt; or its super classes (declaration of 'org.koin.dsl.DefinitionBindingKt' appears in /data/app/com.verifo.app.alpha-DxmqchtBSaC4pvqxW0KKPA==/base.apk!classes8.dex)

This error from Ondato.INSTANCE.startIdentification or calling this method in Expo ondatoSdkRef.current?.open().

I will try this: https://github.com/ondato/ondato-sdk-react-native/issues/4#issuecomment-2129615021. I think also it can happen for koin versions.

Ok, I changed koinVersion from 3.4.0 to 3.2.4 and finally ondato loads screen. But with error

 {
  "status": "Failed",
  "message": "Bad response from server",
  "load": {
    "identificationId": ""
  }
}
esipavicius commented 2 weeks ago

Hello,

We are trying to integrate Ondato into our React Native application at our company, but it seems to be incompatible with the latest version of Expo and React Native.

The issue appears to be specific to Android. iOS is working fine. The application cannot be launched via yarn android, nor can it be successfully built. I am attaching the error log and a link to the repository where the issue can be reproduced. It's a basic React Native Expo project with only the Ondato plugin added.

Expo: ~51.0.28 React-native: 0.74.5 Ondato: 2.5.6

Example project

`> Task :ondato-sdk-react-native:processDebugManifest package="com.ondatosdkreactnative" found in source AndroidManifest.xml: /Users/roman/Desktop/ondato-test/node_modules/ondato-sdk-react-native/android/src/main/AndroidManifest.xml. Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported, and the value is ignored. Recommendation: remove package="com.ondatosdkreactnative" from the source AndroidManifest.xml: /Users/roman/Desktop/ondato-test/node_modules/ondato-sdk-react-native/android/src/main/AndroidManifest.xml.

Task :app:processDebugMainManifest /Users/roman/Desktop/ondato-test/android/app/src/debug/AndroidManifest.xml:6:5-162 Warning: application@android:usesCleartextTraffic was tagged at AndroidManifest.xml:6 to replace other declarations but no other declaration present /Users/roman/Desktop/ondato-test/android/app/src/debug/AndroidManifest.xml Warning: provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:0 to replace other declarations but no other declaration present

Task :ondato-sdk-react-native:compileDebugKotlin e: file:///Users/roman/Desktop/ondato-test/node_modules/ondato-sdk-react-native/android/src/main/java/com/ondatosdkreactnative/OSRNFragment.kt:68:14 Unresolved reference: init e: file:///Users/roman/Desktop/ondato-test/node_modules/ondato-sdk-react-native/android/src/main/java/com/ondatosdkreactnative/OSRNFragment.kt:76:14 Unresolved reference: startIdentification

Task :ondato-sdk-react-native:compileDebugKotlin FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':ondato-sdk-react-native:compileDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details

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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1m 43s 317 actionable tasks: 117 executed, 200 from cache Error: /Users/roman/Desktop/ondato-test/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a,armeabi-v7a exited with non-zero code: 1 Error: /Users/roman/Desktop/ondato-test/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a,armeabi-v7a exited with non-zero code: 1 at ChildProcess.completionListener (/Users/roman/Desktop/ondato-test/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23) at Object.onceWrapper (node:events:629:26) at ChildProcess.emit (node:events:514:28) at maybeClose (node:internal/child_process:1105:16) at ChildProcess._handle.onexit (node:internal/child_process:305:5) ... at spawnAsync (/Users/roman/Desktop/ondato-test/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23) at spawnGradleAsync (/Users/roman/Desktop/ondato-test/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:96:48) at assembleAsync (/Users/roman/Desktop/ondato-test/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:74:18) at runAndroidAsync (/Users/roman/Desktop/ondato-test/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:45:37) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

I managed how to run Ondato.