reduce SIZE
I noticed that even a very basic App will lead to an at-least 52MB APK file. Is it really necessary that, the built apk file so much huge be? Is it possible to diminish the SIZE?
It's because the node has to be embedded in the app. That's around 30MB just for pc, so it could be bigger for android support. Also maybe you have some images, scripts etc, that might add space too.
Hey, we have created a slack channel for support & discussion: join here
What is the solution for this problem ? I want to reduce my apk size. Is there any solution for this?
This is the only problem preventing me from adopting androidjs to create my apps
Apk webview only (#144) feature would be one of the solution.
Other one would be some sort of reusing already existing nodejs installation (?). Some sort of dependency on base/ shared app with nodejs environment for every androidjs webview app (many to one)? I think it would be nice feature.
@PawelSuwinski we had thought of the same approach but it has some complexity in UX and security-wise that's why we didn't implement this that way.
@Chhekur OK, so what about another approach to meet this size reducing requirement in a halfway between webview-only-SDK and with-node-SDK by implementing some simplified version of child_process.spawnSync to execute system commands?
There are a few useful base utils in android /system/bin/ (for example toybox) and shell poweruser can accomplish quite a bit of these in as part of backend processing especially in conjunction with app API.
For example:
// trigger VIEW actiton by ActivityManager
const file = app.getPath('downloads') + '/some/file.txt';
{pid, stdout, stderr, status, error} = app.exec('am', [...'start --user 0 -a android.intent.action.VIEW -d'.split(' '), file]);
// read file
{...} = app.exec('cat', [file]);
// save file
{...} = app.exec('cat > ', [file], { input: myData, shell: true});
And so on... leaving with-node-SDK version to more advanced tasks and backend processing.
@Chhekur OK, so what about another approach to meet this size reducing requirement in a halfway between webview-only-SDK and with-node-SDK by implementing some simplified version of
child_process.spawnSyncto execute system commands?There are a few useful base utils in android
/system/bin/(for exampletoybox) and shell poweruser can accomplish quite a bit of these in as part of backend processing especially in conjunction withappAPI.For example:
// trigger VIEW actiton by ActivityManager const file = app.getPath('downloads') + '/some/file.txt'; {pid, stdout, stderr, status, error} = app.exec('am', [...'start --user 0 -a android.intent.action.VIEW -d'.split(' '), file]); // read file {...} = app.exec('cat', [file]); // save file {...} = app.exec('cat > ', [file], { input: myData, shell: true});And so on... leaving with-node-SDK version to more advanced tasks and backend processing.
some error happened,app.exec is right?
$("#open").on("click", ()=>{
var params = `start --user 0 -a android.intent.action.VIEW -d ${link}`.split(' ')
app.exec('am', params);
})
And what logcat says?
app.exec is not a function
I am afraid that this feature was not merged yet and is not present at dist version: https://github.com/android-js/android-native-apis/pull/15