mozilla / mozilla/rust-android-gradle

NDK version compatibility

Open
#105 25 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
1.3k
Forks
95
Avg merge
15m
Merged PRs (30d)
2

Description

Hi everyone,

We've been facing a new runtime issue on one of our open source projects, when we switched from NDK version 22.1.7171670 to a newer version 23.1.7779620. Only emulator x86_64 devices suffer from this failure. I've tried to reproduce the failure on your sample app project, but I wasn't able to make the project be built, as there is some problem with Android Studio run configurations. So I better ask here for help. Thank you in advance. Any help is really appreciated. Below is a list of next information, which can be useful:

  • The problem in in the Android NDK beginning from version 23.1.7779620. The latest 23 version 23.2.8568313 suffers from this failure too.
  • Tested also with latest 24 version 24.0.8215888 and latest 25 version 25.0.8528842, which unfortunately finished its build phase with a failure - there are probably other changes in the NDK, which we need to adopt first
  • It's related to the x86_64 architecture, we can be sure, because emulators with SDK API 30 with x86 work well, but the x86_64 suffer with the crash.
  • We currently use the Rust Gradle Plugin version 0.9.3. Its version is not important.
  • The runtime failure can be reproduced in our open source project on Main branch by:
    1. Build and launch DemoApp
    2. Open the side menu and click Get Address
    3. App will then crash
  • We partially solved the issue by reverting our NDK version back to 22.1.7171670
  • Our related filed issue can be found here https://github.com/zcash/zcash-android-wallet-sdk/issues/539
  • Below is the stack trace of the runtime crash:
java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String[][] cash.z.ecc.android.sdk.tool.DerivationTool.deriveUnifiedViewingKeysFromSeed(byte[], int, int) (tried Java_cash_z_ecc_android_sdk_tool_DerivationTool_deriveUnifiedViewingKeysFromSeed and Java_cash_z_ecc_android_sdk_tool_DerivationTool_deriveUnifiedViewingKeysFromSeed___3BII)
        at cash.z.ecc.android.sdk.tool.DerivationTool.deriveUnifiedViewingKeysFromSeed(Native Method)
        at cash.z.ecc.android.sdk.tool.DerivationTool.access$deriveUnifiedViewingKeysFromSeed(DerivationTool.kt:8)
        at cash.z.ecc.android.sdk.tool.DerivationTool$Companion.deriveUnifiedViewingKeysFromSeed(Unknown Source:0)
        at cash.z.ecc.android.sdk.tool.DerivationTool$Companion.access$deriveUnifiedViewingKeysFromSeed(DerivationTool.kt:10)
        at cash.z.ecc.android.sdk.tool.DerivationTool$Companion$deriveUnifiedViewingKeys$2.invoke(DerivationTool.kt:23)
        at cash.z.ecc.android.sdk.tool.DerivationTool$Companion$deriveUnifiedViewingKeys$2.invoke(DerivationTool.kt:22)
        at cash.z.ecc.android.sdk.tool.DerivationTool$Companion.withRustBackendLoaded(DerivationTool.kt:109)
        at cash.z.ecc.android.sdk.tool.DerivationTool$Companion.access$withRustBackendLoaded(DerivationTool.kt:10)
        at cash.z.ecc.android.sdk.tool.DerivationTool$Companion$withRustBackendLoaded$1.invokeSuspend(Unknown Source:15)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:279)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
        at cash.z.ecc.android.sdk.demoapp.demos.getaddress.GetAddressFragment.setup(GetAddressFragment.kt:40)
        at cash.z.ecc.android.sdk.demoapp.demos.getaddress.GetAddressFragment.onCreate(GetAddressFragment.kt:60)
        at androidx.fragment.app.Fragment.performCreate(Fragment.java:2981)
        at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:474)
        at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:257)
        at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
        at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1764)
        at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
        at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Thank you for your thoughts on this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash in DemoApp on an x86_64 emulator, following the Get Address flow and the stack trace entry at GetAddressFragment.kt:40. Read DerivationTool.kt and compare behavior across the listed Android NDK versions, especially 22.1.7171670 versus 23.1.7779620. Done means the Get Address flow no longer crashes on x86_64 with a supported newer NDK, with the compatibility findings documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, rust
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.