Making Cordova easier

I’m noticing that Cordova is a pretty common pain point for F-Droid, so I wanted to bring up a discussion here. I have been trying to learn about it and have only made progress by digging through many random threads. Hopefully this thread can serve to begin compiling information and discussing how we can make it easier to include Cordova apps in F-Droid.

Here are a few useful links chadcurtis found while digging. This is coming from the perspective of trying to reverse-engineer what other people have done to make this work.

https://hastebin.com/amemalubeq.scala (I can’t add more than 2 links to this post as a new user)

I think it would be great to have a wiki article just about Cordva. I’m hoping the discussion here may facilitate that.

1 Like

Thank you for your engagement. If you want to create a wiki article, I suggest you to open a merge request on the new website, because we will likely drop the old wiki in favor of this.

Thanks! I’d like to get started on that. However, I’m learning as I’m going along.

One thing I’m curious about: is Cordova installed on the F-Droid server? I’ve noticed a few app repos include the entire Cordova source code within them so it will properly build on the server. I’m sure this has been considered, but is there a better way to do this?

Pinging in @chad.curtis who is also working on this

At one stage I was interested in trying to get a Cordova app built using the F-Droid server. My first port of call was to jump into F-Droid / Data · GitLab and search for other apps which are indeed built and released on F-Droid that use Cordova.

I’m not sure if they all use different recipies or not, but you could have a read through some of them to get some ideas.

It could be great to add cordova apps into f-droid repository.
I also submitted an inclusion request for my app Pi-hole Droid (#48) · Issues · F-Droid / Requests For Packaging · GitLab made with Apache Cordova. On the app’s repository there are all the files generated from cordova exept these:

platforms/android/assets/www
platforms/android/bin/
platforms/android/gen/
platforms/android/res/xml/config.xml
platforms/android/build/

Usually, when I make an update for the app, I launch a simple “cordova build --release android” that it will generate the apk to /platforms/android/build/outputs/apk/android-release-unsigned.apk

Please let me know If I can help in some way.

I know nothing about cordova. Is there a standard build config file that is in the project? For example, gradle builds always have build.gradle and settings.gradle. If so, then we should be able to auto-detect cordova builds, then just call cordova build --release android and auto-fetch the unsigned APK from the standard location.

1 Like

I’m analyzing my Github repo and I see that there is build.gradle file https://github.com/friimaind/pi-hole-droid/blob/master/platforms/android/build.gradle and settings.gradle https://github.com/friimaind/pi-hole-droid/blob/master/platforms/android/settings.gradle file :slight_smile:

Ok, but how about files that are for Cordova?

Sorry hans but maybe I did not understand well :slight_smile:

I try to describe you how I developed and published my apk:

  • install nodejs and npm
  • install cordova with npm
  • create a new app “cordova create hello com.example.hello HelloWorld”
  • now I have “cordova” to compile my app (which is essentially a web app made with html, js…)

The process to compile my apk is:

  • cordova build --release android

which creates an unsigned apk inside platforms/android/build/outputs/apk/android-release-unsigned.apk

For Google Play Store I need to sign my apk with my personal developer’s key but I think that with F-Droid is not required (?).

I my personal app all the files are inside the repo GitHub - friimaind/pi-hole-droid: Pi-hole Droid is an unofficial app that connects to your Pi-hole to show charts and statistics.

Please let me know if I can help you further

Does this work with the nodejs Debian package? Imagine you just
installed a new Debian/jessie machine: what exact steps would you take
to install cordova, then run the build. These steps should be in a script.

These are the steps I followed for my Ubuntu (tested on 16.04/16.10 and now on my 17.04):

nodejs/npm install

  • sudo apt-get install nodejs
  • sudo apt-get install npm

cordova install

  • sudo npm install -g cordova

Assuming that you will clone my app from Github you will do:

  • cd into the root of the app
  • cordova build --release android

The unsigned apk will be inside platforms/android/build/outputs/apk/android-release-unsigned.apk

One thing to consider is that, first of all, you obviously need Java + Android SDK which, in my case, I got them from webupd8.org (java) and Google Android Studio (sdk). In particoular:

Java from webupd8 ppa

  • sudo add-apt-repository ppa:webupd8team/java
  • sudo apt-get update
  • sudo apt-get install oracle-java8-installer

Android SDK following Install Android Studio  |  Android Developers

How much do Cordoba builds rely on the most recent release of nodejs and
npm? The buildserver runs Debian/stable (currently Jessie), so it is
guaranteed to be an older version. So if the Debian/jessie versions are
not useful, then the nodejs/npm installs should happen using the new
sudo= build field.

A Cordova App is a full package.
In fact you build for Microsoft, Iphone, Android…
It’s a generated APK for Android.
The packages are separated in the structure of the project and different with the implementation of Cordova for the targeted phone OS (ex: notifications).
On my Android, I tested the app: “Cordova Showcase”.
Could be a good start :slight_smile:
You have a link to the github project.

https://play.google.com/store/apps/details?id=br.com.marcioggs.cordovashowcase

Totally irrelevant to the topic. This does not integrate into F-Droid and doesn’t even compile Cordova apps anyway. Post should be removed.