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

after upgrade 0.66.4 -> 0.69.1 build was success but it crash when startup app...

Open rdtf1230 opened this issue 2 years ago • 23 comments

New Version

0.69.1

Old Version

0.66.4

Build Target(s)

android

Output of react-native info

System: OS: Windows 10 10.0.19044 CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz Memory: 7.68 GB / 31.94 GB Binaries: Node: 14.18.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD npm: 7.6.3 - ~\AppData\Roaming\npm\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: AI-212.5712.43.2112.8609683 Visual Studio: Not Found Languages: Java: 11.0.8 - /c/Program Files/Common Files/Oracle/Java/javapath/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.1 => 0.69.1 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found

Issue and Reproduction Steps

just startup app, it craash by logcat here java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: couldn't find DSO to load: libjsc.so

i saw upgrade helper, and I have modified all the files

but i cant escape this crash...

I'm using productFlavors, could this be a problem?

flavorDimensions "mode" productFlavors { dev { dimension "mode" } prod { dimension "mode" } staging { dimension "mode" } }

rdtf1230 avatar Jul 19 '22 02:07 rdtf1230

I've battled that error before on an earlier version of RN. I don't recall the solution right now, but google is your friend with this one. If it comes back to me, I'll post it.

nschild avatar Jul 20 '22 13:07 nschild

I've battled that error before on an earlier version of RN. I don't recall the solution right now, but google is your friend with this one. If it comes back to me, I'll post it.

oh plz help me ;)

rdtf1230 avatar Jul 20 '22 19:07 rdtf1230

@nschild Any recollection?

quicksilverr avatar Jul 21 '22 13:07 quicksilverr

@rdtf1230 Maybe related to this?

lenoirzamboni avatar Jul 22 '22 14:07 lenoirzamboni

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: couldn't find DSO to load: libjsc.so

This might be a valid bug, but in order to investigate this we need:

  • To know what's the version of Gradle & Android Gradle Plugin you're using
  • Someone to try out of a release build on a fresh React Native 0.69.1 project

If the latter is turning out to crash with the same stacktrace, that it's a bug that we need to fix.

cortinico avatar Jul 22 '22 14:07 cortinico

@rdtf1230아마도 이것과 관련 있습니까? it didnt work for me.... logcat just said 'java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: couldn't find DSO to load: libjsc.so'

rdtf1230 avatar Jul 23 '22 12:07 rdtf1230

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: couldn't find DSO to load: libjsc.so

This might be a valid bug, but in order to investigate this we need:

  • To know what's the version of Gradle & Android Gradle Plugin you're using
  • Someone to try out of a release build on a fresh React Native 0.69.1 project

If the latter is turning out to crash with the same stacktrace, that it's a bug that we need to fix.

here is my gradle android/build.gradle - classpath("com.android.tools.build:gradle:7.1.1") android/gradle/wrapper/gradle-wrapper.properties - https://services.gradle.org/distributions/gradle-7.3.3-all.zip

and its all belongs to upgrade helper 0.66.4 -> 0.69.1 image image

rdtf1230 avatar Jul 23 '22 12:07 rdtf1230

@rdtf1230 any solutions? This problem has been bothering me for a long time.

Limoer96 avatar Jul 25 '22 06:07 Limoer96

@rdtf1230 any solutions? This problem has been bothering me for a long time.

Unfortunately so am I.... Probably I won't upgrade until I find a workaround

rdtf1230 avatar Jul 25 '22 07:07 rdtf1230

I am also experiencing same problem. When I checked the crash log from the installed apk on a physical device I got the following report:

FATAL EXCEPTION: create_react_context

java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release. 
  • react v18.0.0
  • react-native v0.69.3
  • com.android.tools.build:gradle:7.0.4

Is there any work around or fix for this?

@cortinico

codeOlam avatar Jul 26 '22 13:07 codeOlam

I am also experiencing same problem. When I checked the crash log from the installed apk on a physical device I got the following report:

FATAL EXCEPTION: create_react_context

java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release. 
* react v18.0.0

* react-native v0.69.3

* com.android.tools.build:gradle:7.0.4

Is there any work around or fix for this?

So i was able to get my project to install and run properly on a physical device by doing the following;

  • installed RN v0.69.2
  • com.android.tools.build:gradle:7.1.1
  • reset metro cache
  • cleaned build
  • then created a new signed apk release.

Hope this helps.

codeOlam avatar Jul 26 '22 23:07 codeOlam

I am also experiencing same problem. When I checked the crash log from the installed apk on a physical device I got the following report:

FATAL EXCEPTION: create_react_context

java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release. 
* react v18.0.0

* react-native v0.69.3

* com.android.tools.build:gradle:7.0.4

Is there any work around or fix for this?

So i was able to get my project to install and run properly on a physical device by doing the following;

  • installed RN v0.69.2
  • com.android.tools.build:gradle:7.1.1
  • reset metro cache
  • cleaned build
  • then created a new signed apk release.

Hope this helps.

it didnt work for me ;) anyway thank you...

rdtf1230 avatar Jul 28 '22 11:07 rdtf1230

Sorry about that, but are you updating the version of an exisiting RN project or starting a new one ? @rdtf1230

codeOlam avatar Jul 28 '22 12:07 codeOlam

죄송합니다. 기존 RN 프로젝트의 버전을 업데이트하거나 새 프로젝트를 시작하시겠습니까?@rdtf1230

Someday i will try ;) Create a new project with 0.69.1 and Move files from an existing from 0.66.4 project

I'm asking because it's something I've never done before. Do other developers usually solve problems like this?? Wonder if i try to step into wrong side...

rdtf1230 avatar Jul 28 '22 12:07 rdtf1230

죄송합니다. 기존 RN 프로젝트의 버전을 업데이트하거나 새 프로젝트를 시작하시겠습니까?@rdtf1230

Someday i will try ;) Create a new project with 0.69.1 and Move files from an existing from 0.66.4 project

I'm asking because it's something I've never done before. Do other developers usually solve problems like this?? Wonder if i try to step into wrong side...

In RN doc, there is a guide that show how to safely upgrade RN versions. either using RN-CLI or manually. you could check it out.

https://reactnative.dev/docs/upgrading

codeOlam avatar Jul 28 '22 14:07 codeOlam

When I create a project using the latest RN version, it works fine for me. But when I config the build variants, it crash on any android simulator.

Limoer96 avatar Jul 29 '22 09:07 Limoer96

When I create a project using the latest RN version, it works fine for me. But when I config the build variants, it crash on any android simulator.

i think so too... the problem is build variants, Is there no solution?

rdtf1230 avatar Jul 29 '22 12:07 rdtf1230

Someone to try out of a release build on a fresh React Native 0.69.1 project

Can someone try to create a reproducer? It would help us investigate what's the root cause of this issue.

cortinico avatar Jul 29 '22 15:07 cortinico

:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

github-actions[bot] avatar Jul 29 '22 15:07 github-actions[bot]

Coming back to this as I had a coworker with a similar issue. Have you tried opening your project in Android Studio then file > sync project files with gradle.

nschild avatar Aug 10 '22 17:08 nschild

I found that RN v0.69.4 seems to solve the above problem @rdtf1230

Limoer96 avatar Aug 12 '22 07:08 Limoer96

I found that RN v0.69.4 seems to solve the above problem @rdtf1230

Thank you so much for posting the answer.

I updated to 0.69.4 after seeing this answer, but the same error kept coming up, I've tried many things and it seems to have finally been fixed Now let's introduce the method

Edit app/build.gradle file

Previously my file was

  1. apply plugin
  2. apply from ... n. project.ext.react

After trying various things, I moved 'project.ext.react' to the top line.

like this

  1. project.ext.react
  2. apply plugin ~~
  3. apply from

When I run the app, I see that the libso error no longer appears, and the problem seems to have been resolved.

I hope this article is helpful to people who have had the same type of problem.

rdtf1230 avatar Aug 17 '22 08:08 rdtf1230

I was having the same problem.

  • react v18.10.0

  • react-native v0.70.3

  • com.android.tools.build:gradle:7.0.4

There was a problema in react-native-gradle-plugin that was fixed, but [email protected]+ uses version 0.70.3.

That solved it for me:

package.json

  {
  .....
  "resolutions": {
    "react-native-gradle-plugin": "0.71.4"
  },
  "dependencies": {
    "react-native-gradle-plugin": "0.71.4"
      .....
  }

react-native+0.70.3.patch

diff --git a/node_modules/react-native/react.gradle b/node_modules/react-native/react.gradle
index 912a407..d182708 100644
--- a/node_modules/react-native/react.gradle
+++ b/node_modules/react-native/react.gradle
@@ -386,8 +386,8 @@ afterEvaluate {
                     // Workaround for Android Gradle Plugin 3.4+ new asset directory
                     into ("merged_assets/${variant.name}/out")
 
-                    // Workaround for Android Gradle Plugin 7.1 asset directory
-                    into("$buildDir/intermediates/assets/${variant.name}/merge${targetName}Assets")
+                    // Workaround for Android Gradle Plugin 7.3 asset directory
+                    into("$buildDir/intermediates/assets/${variant.name}")
                 }
             }
 

cleandersonlobo avatar Oct 18 '22 01:10 cleandersonlobo

I was having the same problem.

  • react v18.10.0
  • react-native v0.70.3
  • com.android.tools.build:gradle:7.0.4

There was a problema in react-native-gradle-plugin that was fixed, but [email protected]+ uses version 0.70.3.

That solved it for me:

package.json

  {
  .....
  "resolutions": {
    "react-native-gradle-plugin": "0.71.4"
  },
  "dependencies": {
    "react-native-gradle-plugin": "0.71.4"
      .....
  }

react-native+0.70.3.patch

diff --git a/node_modules/react-native/react.gradle b/node_modules/react-native/react.gradle
index 912a407..d182708 100644
--- a/node_modules/react-native/react.gradle
+++ b/node_modules/react-native/react.gradle
@@ -386,8 +386,8 @@ afterEvaluate {
                     // Workaround for Android Gradle Plugin 3.4+ new asset directory
                     into ("merged_assets/${variant.name}/out")
 
-                    // Workaround for Android Gradle Plugin 7.1 asset directory
-                    into("$buildDir/intermediates/assets/${variant.name}/merge${targetName}Assets")
+                    // Workaround for Android Gradle Plugin 7.3 asset directory
+                    into("$buildDir/intermediates/assets/${variant.name}")
                 }
             }
 

Thanks for this! This helped me realize what caused my production crashes on RN 0.70. I bumped my gradle plugin to 7.3.1 and didn't realize that would be a breaking change. Downgrading gradle to the version in the RN template (7.2.1) fixed the runtime crash for me.

aniravi24 avatar Oct 21 '22 03:10 aniravi24

Thanks for this! This helped me realize what caused my production crashes on RN 0.70. I bumped my gradle plugin to 7.3.1 and didn't realize that would be a breaking change. Downgrading gradle to the version in the RN template (7.2.1) fixed the runtime crash for me.

As @aniravi24 mentioned, RN 0.70 builds with AGP 7.2.1 Diverging from the AGP version is not recommended and will most likely cause crashes.

Specifically @cleandersonlobo I see you are on RN 0.70 with AGP 7.0.4. This is not supported. Doing a patch-package of react-native and using "react-native-gradle-plugin": "0.71.4" is not recommended and will result in further update issues in the future.

I'm also closing here as the reproducer I asked was never provided and I suppose the issue was related to a wrong AGP version.

cortinico avatar Oct 21 '22 15:10 cortinico

I was having the same problem.

  • react v18.10.0
  • react-native v0.70.3
  • com.android.tools.build:gradle:7.0.4

There was a problema in react-native-gradle-plugin that was fixed, but [email protected]+ uses version 0.70.3. That solved it for me: package.json

  {
  .....
  "resolutions": {
    "react-native-gradle-plugin": "0.71.4"
  },
  "dependencies": {
    "react-native-gradle-plugin": "0.71.4"
      .....
  }

react-native+0.70.3.patch

diff --git a/node_modules/react-native/react.gradle b/node_modules/react-native/react.gradle
index 912a407..d182708 100644
--- a/node_modules/react-native/react.gradle
+++ b/node_modules/react-native/react.gradle
@@ -386,8 +386,8 @@ afterEvaluate {
                     // Workaround for Android Gradle Plugin 3.4+ new asset directory
                     into ("merged_assets/${variant.name}/out")
 
-                    // Workaround for Android Gradle Plugin 7.1 asset directory
-                    into("$buildDir/intermediates/assets/${variant.name}/merge${targetName}Assets")
+                    // Workaround for Android Gradle Plugin 7.3 asset directory
+                    into("$buildDir/intermediates/assets/${variant.name}")
                 }
             }
 

Thanks for this! This helped me realize what caused my production crashes on RN 0.70. I bumped my gradle plugin to 7.3.1 and didn't realize that would be a breaking change. Downgrading gradle to the version in the RN template (7.2.1) fixed the runtime crash for me.

it worked for me! 7.2.1 version fixed it

HaddyYang avatar Nov 21 '22 10:11 HaddyYang