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

Android failed to build in RN 0.77 #286

Open
Elabar opened this issue Feb 5, 2025 · 2 comments
Open

Android failed to build in RN 0.77 #286

Elabar opened this issue Feb 5, 2025 · 2 comments

Comments

@Elabar
Copy link

Elabar commented Feb 5, 2025

Description

Build fail with

* What went wrong:
Execution failed for task ':rive-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.

Provide a Repro

  1. create a new expo project
npx create-expo-app@latest StickerSmash
  1. upgrade packages to use RN 0.77
    "@expo/vector-icons": "^14.0.4",
    "react-native": "0.77.0",
    "react-native-gesture-handler": "~2.22.1",
    "react-native-reanimated": "~3.16.7",
    "react-native-safe-area-context": "5.2.0",
    "react-native-screens": "~4.6.0",
    "react-native-web": "~0.19.13",
    "react-native-webview": "13.13.2"
  1. Run succesfully
npx expo prebuild --clean
npx expo run:android
  1. Add rive library and run again, project fail to build
npx expo install rive-react-native
npx expo prebuild --clean
npx expo run:android

Expected behavior

Project should build

Additional context

Expo SDK 52 is compatible with react native 0.77. https://expo.dev/changelog/2025/01-21-react-native-0.77

@SurendraSp
Copy link

SurendraSp commented Feb 6, 2025

  • What went wrong:
    Execution failed for task ':rive-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.

BUILD FAILED in 51s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/sp/WebStormProjects/rn-app/node_modules/react-native-video/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
e: file:///Users/sp/WebStormProjects/rn-app/node_modules/rive-react-native/android/src/main/java/com/rivereactnative/RiveReactNativeViewManager.kt:33:41 None of the following candidates is applicable:
fun mapToRNLoopMode(loopMode: String): RNLoopMode
fun mapToRNLoopMode(riveLoopMode: Loop): RNLoopMode
e: file:///Users/sp/WebStormProjects/rn-app/node_modules/rive-react-native/android/src/main/java/com/rivereactnative/RiveReactNativeViewManager.kt:34:60 Argument type mismatch: actual type is 'kotlin.String?', but 'kotlin.String' was expected.

@SurendraSp
Copy link

Temporary Fix

Open RiveReactNativeViewManager.kt File
your-project/node_modules/rive-react-native/android/src/main/java/com/rivereactnative/RiveReactNativeViewManager.kt

Add !! After all getString()

eg.
Previous

val animationName = it.getString(0)
val loopMode = it.getString(1)
val direction = it.getString(2)
val isStateMachine = it.getBoolean(3)

After Change

val animationName = it.getString(0)!!
 val loopMode = it.getString(1)!!
 val direction = it.getString(2)!!
 val isStateMachine = it.getBoolean(3)!!

Note: This temporary fix and you have do the changes in all your systems if you using git and node_module is ignored. Also make sure to keep a eye on Rive update.

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

2 participants