App icon indicating copy to clipboard operation
App copied to clipboard

[$500] Investigate App Crash MainActivity.onCreate

Open mountiny opened this issue 1 year ago β€’ 27 comments

On the 1.4.35-5 build we have got 3 crashes on the OnePlus8Pro device:

image

With the following logs:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.expensify.chat/com.expensify.chat.MainActivity}: java.lang.reflect.InvocationTargetException
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3433)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3607)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2068)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7680)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:423)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

And

Caused by java.lang.reflect.InvocationTargetException:
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:423)
       at expo.modules.ReactActivityDelegateWrapper.invokeDelegateMethod(ReactActivityDelegateWrapper.kt:309)
       at expo.modules.ReactActivityDelegateWrapper.loadApp(ReactActivityDelegateWrapper.kt:112)
       at expo.modules.ReactActivityDelegateWrapper.onCreate(ReactActivityDelegateWrapper.kt:154)
       at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:46)
       at com.expensify.chat.MainActivity.onCreate(MainActivity.kt:36)
       at android.app.Activity.performCreate(Activity.java:7994)
       at android.app.Activity.performCreate(Activity.java:7978)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1548)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3406)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3607)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2068)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7680)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:423)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

or:

Caused by java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.expensify.chat/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0
       at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1228)
       at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:1044)
       at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:956)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:903)
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:869)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:26)
       at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
       at com.facebook.hermes.reactexecutor.HermesExecutor.loadLibrary(HermesExecutor.java:24)
       at com.facebook.react.ReactInstanceManagerBuilder.getDefaultJSExecutorFactory(ReactInstanceManagerBuilder.java:380)
       at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:326)
       at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:98)
       at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:32)
       at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:43)
       at com.facebook.react.ReactDelegate.loadApp(ReactDelegate.java:173)
       at com.facebook.react.ReactActivityDelegate.loadApp(ReactActivityDelegate.java:123)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:423)
       at expo.modules.ReactActivityDelegateWrapper.invokeDelegateMethod(ReactActivityDelegateWrapper.kt:309)
       at expo.modules.ReactActivityDelegateWrapper.loadApp(ReactActivityDelegateWrapper.kt:112)
       at expo.modules.ReactActivityDelegateWrapper.onCreate(ReactActivityDelegateWrapper.kt:154)
       at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:46)
       at com.expensify.chat.MainActivity.onCreate(MainActivity.kt:36)
       at android.app.Activity.performCreate(Activity.java:7994)
       at android.app.Activity.performCreate(Activity.java:7978)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1548)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3406)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3607)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2068)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7680)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:423)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d0d2e521d108526a
  • Upwork Job ID: 1753380240252334080
  • Last Price Increase: 2024-02-02

mountiny avatar Feb 02 '24 11:02 mountiny

Job added to Upwork: https://www.upwork.com/jobs/~01d0d2e521d108526a

melvin-bot[bot] avatar Feb 02 '24 11:02 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

melvin-bot[bot] avatar Feb 02 '24 11:02 melvin-bot[bot]

Triggered auto assignment to @strepanier03 (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] avatar Feb 02 '24 11:02 melvin-bot[bot]

I think there problem with libc++_share.so file. Please pay attention to EM_AARCH64 (183) instead of EM_X86_64 (62). I think if use EM_X86_64 libc++_share.so file will solve problem. Thank you.

yoyumiracle avatar Feb 02 '24 15:02 yoyumiracle

πŸ“£ @yoyumiracle! πŸ“£ Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Feb 02 '24 15:02 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~010e420e4da95306da

I think there problem with libc++_share.so file. Please pay attention to EM_AARCH64 (183) instead of EM_X86_64 (62). I think if use EM_X86_64 libc++_share.so file will solve problem. Thank you.

yoyumiracle avatar Feb 02 '24 18:02 yoyumiracle

βœ… Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Feb 02 '24 18:02 melvin-bot[bot]

@yoyumiracle Could you please present an actionable item here? We use React Native. How can we fix it?

parasharrajat avatar Feb 04 '24 19:02 parasharrajat

allprojects { repositories { google() center() ...

    // force dependency versions on all subprojects
    configurations.all {
        resolutionStrategy {

            // use 0.9.0 to fix crash on Android 11
            force "com.facebook.soloader:soloader:0.9.0"
		}
	}
}

}

I think it would be solve problem.

yoyumiracle avatar Feb 06 '24 17:02 yoyumiracle

`allprojects { repositories { google() center() ...

    // force dependency versions on all subprojects
    configurations.all {
        resolutionStrategy {

            // use 0.9.0 to fix crash on Android 11
            force "com.facebook.soloader:soloader:0.9.0"
		}
	}
}

}`

I think it would be solve problem.

yoyumiracle avatar Feb 06 '24 17:02 yoyumiracle

higher soloader version like I explained above

yoyumiracle avatar Feb 06 '24 17:02 yoyumiracle

Requesting another C+ with a better understanding https://expensify.slack.com/archives/C02NK2DQWUX/p1707246330443299

parasharrajat avatar Feb 06 '24 19:02 parasharrajat

@akinwale will look into this as C+.

parasharrajat avatar Feb 06 '24 19:02 parasharrajat

Seems rather similar to https://github.com/facebook/react-native/issues/41372.

@yoyumiracle Please create a proposal using the proposal template. You can also have a look at the contributing guidelines to get an idea of how to contribute. Thanks.

akinwale avatar Feb 06 '24 19:02 akinwale

I can't understand exactly. @akinwale Can I have further detail about proposal, It will thankful if you give me an example.

yoyumiracle avatar Feb 06 '24 21:02 yoyumiracle

I can't understand exactly. @akinwale Can I have further detail about proposal, It will thankful if you give me an example.

When proposing a solution for the issue, it should follow this format: https://raw.githubusercontent.com/Expensify/App/main/contributingGuides/PROPOSAL_TEMPLATE.md

You can copy the template, edit it with the details of your solution, and then paste it as a comment on the issue.

Hope this helps.

akinwale avatar Feb 06 '24 21:02 akinwale

  1. The issue is runtime error occured when load the libc++_shared library.
  2. It, the root cause maybe concern with facebook's soloader version problem.
  3. I suggest that version up the facebook's soloader by following below explanation. force "com.facebook.soloader:soloader:0.9.0" to build.gradle file.

yoyumiracle avatar Feb 06 '24 21:02 yoyumiracle

@yoyumiracle Please take these steps to post a proposal in the correct format.

  1. Copy the text from https://raw.githubusercontent.com/Expensify/App/main/contributingGuides/PROPOSAL_TEMPLATE.md
  2. Paste it into a new comment on this issue.
  3. Edit it with details of your solution (the cause, and how to fix).
  4. Post the comment.

akinwale avatar Feb 07 '24 00:02 akinwale

Proposal

On the 1.4.35-5 build got 3 crashes on the OnePlus8Pro device:

Caused by java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.expensify.chat/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0

I think it caused by facebooksoloader version is unmatched to device. So recommend that version up the facebooksoloader using this.

    force "com.facebook.soloader:soloader:0.9.0" to build.gradle file.

yoyumiracle avatar Feb 07 '24 16:02 yoyumiracle

Hello Petar @yoyumiracle You must follow this template https://raw.githubusercontent.com/Expensify/App/main/contributingGuides/PROPOSAL_TEMPLATE.md for proposals.

Can you please stop posting comments until you formulate the proposal in expected format? thank you!

mountiny avatar Feb 07 '24 17:02 mountiny

Proposal

Please re-state the problem that we are trying to solve in this issue.

  . On the 1.4.35-5 build we have got 3 crashes on the OnePlus8Pro device

What is the root cause of that problem?

  . Caused by java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so caused by: couldn't find DSO to load: libjsi.so caused by: couldn't find DSO to load: libfolly_runtime.so caused by: couldn't find DSO to load: libglog.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: "/data/data/com.expensify.chat/lib-3/libc++_shared.so" is for EM_AARCH64 (183) instead of EM_X86_64 (62) result: 0 result: 0 result: 0 result: 0 result: 0

What changes do you think we should make in order to solve the problem?

  . I think it caused by facebooksoloader version is unmatched to device. So recommend that version up the facebooksoloader using this. 
    force "com.facebook.soloader:soloader:0.9.0" to build.gradle file.

Sorry for confuse

yoyumiracle avatar Feb 07 '24 18:02 yoyumiracle

We can move forward with @yoyumiracle's proposal here. Based on Google's recommendation, the soloader version should be 0.10.4+.

@yoyumiracle Please use com.facebook.soloader:soloader:0.10.4+ instead of 0.9.0 when creating your PR.

@mountiny After the PR is created, a build needs to be generated that can be tested using browserstack, or by someone who has a physical device, since I do not own a OnePlus 8 Pro.

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed.

akinwale avatar Feb 07 '24 22:02 akinwale

Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Feb 07 '24 22:02 melvin-bot[bot]

Which branch I have to fork?

yoyumiracle avatar Feb 07 '24 23:02 yoyumiracle

Which branch I have to fork?

You can create a fork of the https://github.com/Expensify/App repo on the main branch.

akinwale avatar Feb 07 '24 23:02 akinwale

πŸ“£ @yoyumiracle You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing πŸ“–

melvin-bot[bot] avatar Feb 07 '24 23:02 melvin-bot[bot]

I have created PR. Title: "Investigate App Crash MainActivity.onCreate"

yoyumiracle avatar Feb 08 '24 00:02 yoyumiracle

The proposal for this issue is very vague. Root cause is a copy paste of the stack trace?

Additionally, there are numerous reports of this workaround not fixing the issue on the later RN versions like we are running. https://github.com/facebook/SoLoader/issues/59#issuecomment-1546528130

This is definitely an upstream issue. But we can continue to try to find a workaround.

I went into RN commit history to see what version of soLoader they have for [email protected]( our current version) and it's also using 10.5 for soLoader https://github.com/facebook/react-native/blob/d2ac5d6a55ab0cd3a32c6939b941b31f06ea32e8/packages/react-native/gradle/libs.versions.toml#L30 So my hopes for the PR working is very low.

jeremy-croff avatar Feb 08 '24 01:02 jeremy-croff

Additionally, there are numerous reports of this workaround not fixing the issue on the later RN versions like we are running. facebook/SoLoader#59 (comment)

This is definitely an upstream issue. But we can continue to try to find a workaround.

I went into RN commit history to see what version of soLoader they have for [email protected]( our current version) and it's also using 10.5 for soLoader https://github.com/facebook/react-native/blob/d2ac5d6a55ab0cd3a32c6939b941b31f06ea32e8/packages/react-native/gradle/libs.versions.toml#L30 So my hopes for the PR working is very low.

Thanks for the insight.

If the fix doesn't work, looks like we may need to wait for more proposals until we find one that actually fixes the issue. I'll do some more research on the issue in the mean time.

cc @marcaaron @mountiny

akinwale avatar Feb 08 '24 06:02 akinwale

I can't understand your meanings. It's depends on facebook/Soloader right? We can change it's framework's work flow in our hands. I think if have problem like this, We can consider that it depends on facebook/SoLoader version, right. We must use correct version for correct device. It's my opinion there's no way to solve old version to higher version througly. If then there will be no version control. It's only my opinion. And there's no need to PR?

yoyumiracle avatar Feb 08 '24 09:02 yoyumiracle