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

Get the app to run on intel-based emulator #446

Open
achou11 opened this issue Jun 27, 2024 · 0 comments
Open

Get the app to run on intel-based emulator #446

achou11 opened this issue Jun 27, 2024 · 0 comments

Comments

@achou11
Copy link
Member

achou11 commented Jun 27, 2024

Spent some time this week attempting to get this working, with the original reasoning being that it would make it easier to review PRs that introduce Maestro tests (currently running on a physical device doesn't work, it seems). If you're using an arm-based emulator, this all works just fine (e.g. using a M-series MacBook).

Approaches to get this working:

  1. Build the app to target x86_64 and run on x86_64 emulator

    This is the most ideal option and while I didn't get it to fully work. I was able to identify an issue with the gradle build process in nmrn (see chore: properly detect and copy Intel-based native prebuilds when building apk #443), but that didn't fully resolve things. I ran into a separate issue that seems related to nodejs-mobile:

    node:internal/modules/cjs/loader:1340
      return process.dlopen(module, path.toNamespacedPath(filename));
                    ^
    
    Error: dlopen failed: cannot locate symbol "napi_get_cb_info" referenced by "/data/data/com.comapeo.dev/files/nodejs-project/node_modules/sodium-native/build/Release/sodium.node"...
        at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
        at Module.load (node:internal/modules/cjs/loader:1119:32)
        at Module._load (node:internal/modules/cjs/loader:960:12)
        at Module.require (node:internal/modules/cjs/loader:1143:19)
        at require (node:internal/modules/cjs/helpers:121:18)
        at load (file:///data/data/com.comapeo.dev/files/nodejs-project/index.js:45241:11)
        at file:///data/data/com.comapeo.dev/files/nodejs-project/index.js:45438:20
        at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
      code: 'ERR_DLOPEN_FAILED'
    }
    Node.js v18.17.1

    I stopped pursuing this once I got here. Probably worth creating an issue in nodejs-mobile in case anyone in the community has an idea of what the error entails.

  2. Build the app to target arm64 and run on x86_64 emulator

    Gregor brought to my attention that if the emulator you've created is using >= Android 11, you can run arm-targeting apks on an intel emulator (source). while I didn't get this to fully work, but I learned that in order for this new emulator feature to work properly, I needed to explicitly filtered out intel targets for the ndk by specifying ndkFilter in the app build.gradle. I ran into an issue that gave the following error:

    com.facebook.soloader.SoLoaderDSONotFoundError: couldn't find DSO to load: libfbjni.so

    Was able to get past this error by enabling legacy packaging for jni libs (see https://developer.android.com/build/releases/past-releases/agp-4-2-0-release-notes#compress-native-libs-dsl). However, I ran into a cryptic issue around ndk translation, and decided to stop there:

    ndk_translation: Undefined instruction 0x5ee1b801 at 0x0000749e975e64c4
    libc    : Fatal signal 4 (SIGILL), code -6 (SI_TKILL) in tid 7236 (mqt_js), pid 7175 (om.comapeo.test)

In general, I consider this a nice-to-have and so I don't expect this to be resolved anytime soon, but it's worth documenting all of this in case we need to get this working at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant