Skip to content

How to change Node version inside the Android app? #68

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

Open
anrefst opened this issue Sep 5, 2022 · 1 comment
Open

How to change Node version inside the Android app? #68

anrefst opened this issue Sep 5, 2022 · 1 comment

Comments

@anrefst
Copy link

anrefst commented Sep 5, 2022

When I build my Nodejs Android app with Androidjs and then check version of Node inside via

console.log(JSON.stringify(process.versions))

among others I get

"node":"10.13.0"

This is very old.

How do I get later versions of the Node JS runtime inside the Android app?

Is it maybe even possible to set the exact version of Node to compile the app with?

@notYou263
Copy link

Hey, I figured out how to update the node version.

Basically androidjs-builder / androidjs build command is

  1. downloading the androidjs-sdk as zip file, and unzip in cache folder (https://github.com/android-js/androidjs-sdk)
  2. copying your project files into the unzipped androidjs-sdk folder
  3. and rebuilding the apk file using apktool

I am not familiar with Android App Development, or Java.
It tooks a while for me to find out what the androidjs-sdk actually is.
It is simply a decoded apk file of a basic Android App using nodejs.

So I took a look at https://github.com/android-js/androidjs-core-webview where is a description of
how to create
"An Android Studio project that uses the Node.js on Mobile shared library."

Just follow the readme instructions.
But instead of using the linked nodejs-v10 -android files from inactive repo for the header files etc,
head over to https://github.com/nodejs-mobile/nodejs-mobile and download the latest release.

You also have to remove "x86" from abiFilters in gradle settings (see https://github.com/android-js/androidjs-core-webview#configure-the-apps-gradle-settings )

Build and Test the Android Project. It should run now using nodejs v16.
Locate the apk file of the Android Project build, then use apktool to decode the apk file.

The output is simliar to "androidjs-sdk folder" at step 1.

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