bunsenbrowser / bunsen

🔥 Bunsen Browser provides easy to use offline P2P application and file distribution that is verifiable on Android devices. https://bunsenbrowser.github.io/
117 stars 7 forks source link

Refactoring to use nodejs-mobile-cordova #36

Closed chrisekelley closed 6 years ago

chrisekelley commented 6 years ago

Here are some notes during my refactoring of bunsen to use https://github.com/janeasystems/nodejs-mobile-cordova instead of the current https://github.com/bunsenbrowser/cordova-node-plugin . Why the change? nodejs-mobile-cordova supports ARMv7a and x86 CPU architectures on Android and also supports IOS as well.

chrisekelley commented 6 years ago

The nodejs-mobile-cordova plugin does not support Cordova 8: https://github.com/janeasystems/nodejs-mobile-cordova/pull/4 . so i've installed Cordova 7.0.0. I have also created the ./www/nodejs-project/ structure using the ./plugins/nodejs-mobile-cordova/install/sample-project/copy-sample-project.sh script as recommended in the readme.

I also had to create www/js/index.js (throws an error otherwise); the copy-sample-project script adds some code to detect deviceready and start the node project:

function startNodeProject() {
    nodejs.channel.setListener(channelListener);
    nodejs.start('main.js', startupCallback);
    // To disable the stdout/stderr redirection to the Android logcat:
    // nodejs.start('main.js', startupCallback, { redirectOutputToLogcat: false });
};
chrisekelley commented 6 years ago

Currently getting the message "compileSdkVersion is not specified." when running cordova build android.

MacOSX High Sierra Node version: v9.5.0 Cordova version: 7.0.0

Once I removed the old cordova-node-plugin plugin, compilation processed until I got another error:

com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/BuildHelper;
chrisekelley commented 6 years ago

The plugin cordova-plugin-compat is no longer necessary in cordova-android 6.3.0. cordova-plugin-file depends on it, so I removed it too, and now it compiles.