OK that works. Thanks!
I have encounterd few issues though.
1/
When running
cordova build android
I got the following error:
Error: ENOENT: no such file or directory, open '/home/romain/repos/bahmni-offline/android/platforms/android/res/xml/config.xml
Full error log:
cp: copyFileSync: could not write to dest file (code=ENOENT):/home/romain/repos/bahmni-offline/android/platforms/android/res/xml/config.xml
Parsing /home/romain/repos/bahmni-offline/android/platforms/android/res/xml/config.xml failed
(node:20851) UnhandledPromiseRejectionWarning: ``Error: ENOENT: no such file or directory, open '/home/romain/repos/bahmni-offline/android/platforms/android/res/xml/config.xml`'`
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:348:35)
at Object.parseElementtreeSync (/home/romain/repos/bahmni-offline/android/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
at new ConfigParser (/home/romain/repos/bahmni-offline/android/platforms/android/cordova/node_modules/cordova-common/src/ConfigParser/ConfigParser.js:30:24)
at updateConfigFilesFrom (/home/romain/repos/bahmni-offline/android/platforms/android/cordova/lib/prepare.js:106:18)
at Api.module.exports.prepare (/home/romain/repos/bahmni-offline/android/platforms/android/cordova/lib/prepare.js:42:20)
at Api.prepare (/home/romain/repos/bahmni-offline/android/platforms/android/cordova/Api.js:192:45)
at /usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:106:36
at _fulfilled (/usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
at /usr/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30
(node:20851) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20851) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This was solved by building the adding the platform android 6.4.0
# remove the previous one
cordova platform remove android
# add it with a specified version
cordova platform add android@6.4.0
2/
Another error came up when building with Cordova related to accepting the Andoird SDK licences:
License for package Android SDK Platform 26 not accepted
Full error log:
Running command: /home/romain/repos/bahmni-offline/android/hooks/after_prepare/010_add_platform_class.js /home/romain/repos/bahmni-offline/android
add to body class: platform-android
ANDROID_HOME=/home/romain/Android/Sdk/
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_21k9ntgdmxn3yddljog91eh80.run(/home/romain/repos/bahmni-offline/android/platforms/android/build.gradle:141)
Checking the license for package Android SDK Platform 26 in /home/romain/Android/Sdk/licenses
Warning: License for package Android SDK Platform 26 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 26].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
(node:21783) UnhandledPromiseRejectionWarning: Error: /home/romain/repos/bahmni-offline/android/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 26].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
Solved by following this:
Accept licences with this command:
$ANDROID_HOME/tools/bin/sdkmanager --licenses