Skip to content
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

Build for Android and iOS #475

Closed
st-patrick opened this issue Nov 28, 2019 · 47 comments
Closed

Build for Android and iOS #475

st-patrick opened this issue Nov 28, 2019 · 47 comments
Labels
bug Something isn't working

Comments

@st-patrick
Copy link
Contributor

Hello!
The time has come and we are trying to run our first build.

So far, I've been trying to follow whatever instructions I was able to find and started by creating android keys and changing the package id to ours (com.mcqdev.emission) as well as setting the version code back to 1.

Then I ran ./bin/sign_and_align_keys.sh which didn't really work I guess.

After that, I read a little bit and then followed with the commands

cordova platform add android
cordova prepare
cordova build android

The commands failed at first but after changing minSDK in config.xml to 19 (which was explained in the error output) and also removed the following line in config.xml, which kept causing the build to fail since it couldn't be found anywhere. also, I couldn't find any similar named file in the entire project, so I decided to delte this line:
<hook src="package-hooks/ios9_allow_http.sh" type="after_prepare" />

Now I got the apk built (finally^^) but it's forever stuck in loading screen. The inspector tells me that cordova_plugins.js couldn't be found. It's probably because I changed the organisation name in package.json, too which was probably not correct.

I'll keep this issue open until I get all the builds for android and ios done, since I couldn't really find a good step by step documentation of building in the docs so far

@st-patrick
Copy link
Contributor Author

ok so now I am trying to build the "basic" app from when we forked from master without any changes.
It seems cordova_plugins.js is generated but there is another bump with cordova 9.0.0 and the q package.

Trying to run a build will result in:

Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

This seems to be a known problem, see this post:
https://stackoverflow.com/questions/55304065/cordova-error-using-requirecordovamodule-to-load-non-cordova-module-q-is-n

So now I'll downgrade to cordova 8.1.0 and try again

@st-patrick
Copy link
Contributor Author

Actually I didn't downgrade but instead did what the error said, which was to remove the mentioned instances of context.requireCordovaModule with simply require.

Also, I get now that, of course, the correct order is to build first and then the sign_and_align_keys script will have something to work with.

After a lot of bouncing around, understanding the sign_and_align_keys script and removing webwalk plugin, I finally got the signed apk

but

still stuck in the loading screen, forever spinning the spinny loader.

@st-patrick
Copy link
Contributor Author

ah yes, it seems I missed pretty much the entire lower part of the readme^^where it says to install cordova 8 and the http ios hook

@shankari
Copy link
Contributor

so if you use the lower part of the README, are there still any pending issues?

  • If there are still pending issues, can you list them here?
  • If there are no pending issues, can you submit a PR to change the docs to highlight the lower part of the README (since you missed it?!) and close this issue?

@st-patrick
Copy link
Contributor Author

yes definitely.

It seems some configuration in package.cordovabuild.json is not working.

I am always working on the latest master on the official repo now, just to make sure the build works on the original code.

I download it, configure, do npm and bower install etc.
Also, my terminal has the following versions of software:
node 9.4.0
npm 5.6.0
cordova 8.0.0
ionic 3.19.1

Then, I wanted to execute the cordovabuild configuration but it causes the following problems:

mcquadrat@MC-L-00053 e-mission-phone % ./bin/configure_xml_and_json.js cordovabuild
Copied config.cordovabuild.xml -> config.xml and package.cordovabuild.json -> package.json
mcquadrat@MC-L-00053 e-mission-phone % npm install
npm WARN edu.berkeley.eecs.emission@2.8.1 No repository field.
npm WARN edu.berkeley.eecs.emission@2.8.1 No license field.

npm ERR! path /Users/mcquadrat/Documents/e-mission-phone/node_modules/npm/node_modules/ansistyles
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/mcquadrat/Documents/e-mission-phone/node_modules/npm/node_modules/ansistyles' -> '/Users/mcquadrat/Documents/e-mission-phone/node_modules/npm/node_modules/.ansistyles.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mcquadrat/.npm/_logs/2019-11-28T15_45_48_122Z-debug.log
mcquadrat@MC-L-00053 e-mission-phone % npm run serve

> edu.berkeley.eecs.emission@2.8.1 serve /Users/mcquadrat/Documents/e-mission-phone
> phonegap --verbose serve

module.js:557
    throw err;
    ^

Error: Cannot find module 'dezalgo'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/mcquadrat/Documents/e-mission-phone/node_modules/npm/lib/utils/correct-mkdir.js:2:15)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! edu.berkeley.eecs.emission@2.8.1 serve: `phonegap --verbose serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the edu.berkeley.eecs.emission@2.8.1 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mcquadrat/.npm/_logs/2019-11-28T15_45_57_687Z-debug.log

Now, I will just stay with the "serve" configuration and try to build the debug apk from there

@shankari
Copy link
Contributor

Now, I will just stay with the "serve" configuration and try to build the debug apk from there

You cannot build an apk with the 'server' configuration because it does not list the required plugins.

@shankari
Copy link
Contributor

shankari commented Nov 28, 2019

npm ERR! path /Users/mcquadrat/Documents/e-mission-phone/node_modules/npm/node_modules/ansistyles
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/mcquadrat/Documents/e-mission-phone/node_modules/npm/node_modules/ansistyles' -> '/Users/mcquadrat/Documents/e-mission-phone/node_modules/npm/node_modules/.ansistyles.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

This is almost certainly related to the incorrect npm version. Please make sure that the versions exactly match the versions listed in the README.

@st-patrick
Copy link
Contributor Author

ok. Then I'll get a fresh checkout from master again and build the "cordovabuild" version from the start. Maybe it's just a problem if you do npm install with the package.serve.json

Alright, I'll try to get exactly the correct npm version

@shankari
Copy link
Contributor

shankari commented Nov 28, 2019

Note that the npm version error was previously reported in #290, and I gave the exact same response. You might want to look at prior issues to resolve the errors that you see.

@st-patrick
Copy link
Contributor Author

I run into the same issue I had before while trying to run cordova prepare / platform / build:

mcquadrat@MC-L-00053 e-mission-phone % cordova prepare
Running command: /Users/mcquadrat/Documents/e-mission-phone/hooks/before_prepare/download_translation.js /Users/mcquadrat/Documents/e-mission-phone
(node:51879) UnhandledPromiseRejectionWarning: Error: spawn EACCES
    at _errnoException (util.js:1003:13)
    at ChildProcess.spawn (internal/child_process.js:340:11)
    at Object.exports.spawn (child_process.js:499:9)
    at Object.exports.spawn (/Users/mcquadrat/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/cordova-common/src/superspawn.js:134:31)
    at runScriptViaChildProcessSpawn (/Users/mcquadrat/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:225:23)
    at runScript (/Users/mcquadrat/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:166:16)
    at /Users/mcquadrat/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:132:20
    at _fulfilled (/Users/mcquadrat/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/Users/mcquadrat/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/Users/mcquadrat/.nvm/versions/node/v9.4.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:749:13)
(node:51879) 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:51879) [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.

Also, I noticed that in "cordovabuild", the command npm run setup-serve is not run and thus some files are missing compared to the "serve" configuration, is that correct?

@shankari
Copy link
Contributor

Also, I noticed that in "cordovabuild", the command npm run setup-serve is not run and thus some files are missing compared to the "serve" configuration, is that correct?

Yes, serve is for use with the devapp. cordovabuild is if you want to actually build the app.

Running command: /Users/mcquadrat/Documents/e-mission-phone/hooks/before_prepare/download_translation.js /Users/mcquadrat/Documents/e-mission-phone

This looks like it is related to the new i18n code.
Let me check if that file exists...

@shankari
Copy link
Contributor

That file definitely exists.
https://github.com/e-mission/e-mission-phone/blob/master/hooks/before_prepare/download_translation.js

What happens if you run the script manually?

@st-patrick
Copy link
Contributor Author

Simple mistake. The file didn't have execute permission, sorry about that.

Ok, let's see if I can proceed to build now

@shankari
Copy link
Contributor

Note that you probably also want to actually generate a german translation at some point. Thanks to @DO3B for building the i18n framework that makes it easy to do this!

@shankari
Copy link
Contributor

Simple mistake. The file didn't have execute permission, sorry about that.

Maybe it should be executable by default. Would be great if you could submit a PR for that too 😄

@st-patrick
Copy link
Contributor Author

ok now this is the most recent problem amongst others:

mcquadrat@MC-L-00053 e-mission-phone % cordova build android
Copying locales: Languages found -> fr,it
Copying locales: I found fr, I will now copy the files.
Copying locales: Copying /Users/mcquadrat/Documents/e-mission-phone/locales/fr/values-fr to /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res
Copying locales: /Users/mcquadrat/Documents/e-mission-phone/locales/fr/values-frcopied...
Copying locales: Copying /Users/mcquadrat/Documents/e-mission-phone/locales/fr/i18n/ to /Users/mcquadrat/Documents/e-mission-phone/www/i18n/
Copying locales: /Users/mcquadrat/Documents/e-mission-phone/locales/fr/i18n/copied...
Copying locales: I found it, I will now copy the files.
Copying locales: Copying /Users/mcquadrat/Documents/e-mission-phone/locales/it/values-it to /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res
Copying locales: /Users/mcquadrat/Documents/e-mission-phone/locales/it/values-itcopied...
Copying locales: Copying /Users/mcquadrat/Documents/e-mission-phone/locales/it/i18n/ to /Users/mcquadrat/Documents/e-mission-phone/www/i18n/
Copying locales: /Users/mcquadrat/Documents/e-mission-phone/locales/it/i18n/copied...
Running command: /Users/mcquadrat/Documents/e-mission-phone/hooks/before_prepare/download_translation.js /Users/mcquadrat/Documents/e-mission-phone
/usr/bin/git
Downloading locales: /Users/mcquadrat/Documents/e-mission-phone/bin/conf/translate_config.json not found, I will extract translate repo from translation_config.json.sample.
Already up to date.
Running command: /Users/mcquadrat/Documents/e-mission-phone/hooks/after_prepare/010_add_platform_class.js /Users/mcquadrat/Documents/e-mission-phone
add to body class: platform-android
Running command: /Users/mcquadrat/Documents/e-mission-phone/hooks/after_prepare/015_copy_icon_to_drawable.js /Users/mcquadrat/Documents/e-mission-phone
About to copy file /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/mipmap-hdpi/icon.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-hdpi/icon.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/mipmap-ldpi/icon.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-ldpi/icon.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/mipmap-mdpi/icon.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-mdpi/icon.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/mipmap-xhdpi/icon.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xhdpi/icon.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/mipmap-xxhdpi/icon.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xxhdpi/icon.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/mipmap-xxxhdpi/icon.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xxxhdpi/icon.png
Running command: /Users/mcquadrat/Documents/e-mission-phone/hooks/after_prepare/020_copy_notification_icons.js /Users/mcquadrat/Documents/e-mission-phone
About to copy icons from /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-hdpi/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-hdpi/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-hdpi-v11/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-hdpi-v11/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-hdpi-v9/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-hdpi-v9/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-mdpi/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-mdpi/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-mdpi-v11/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-mdpi-v11/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-mdpi-v9/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-mdpi-v9/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-xhdpi/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xhdpi/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-xhdpi-v11/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xhdpi-v11/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-xhdpi-v9/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xhdpi-v9/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-xxhdpi/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xxhdpi/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-xxhdpi-v11/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xxhdpi-v11/ic_mood_question.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_mood_question/drawable-xxhdpi-v9/ic_mood_question.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xxhdpi-v9/ic_mood_question.png
About to copy icons from /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-hdpi/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-hdpi/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-hdpi-v11/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-hdpi-v11/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-hdpi-v9/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-hdpi-v9/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-mdpi/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-mdpi/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-mdpi-v11/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-mdpi-v11/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-mdpi-v9/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-mdpi-v9/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-xhdpi/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xhdpi/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-xhdpi-v11/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xhdpi-v11/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-xhdpi-v9/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xhdpi-v9/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-xxhdpi/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xxhdpi/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-xxhdpi-v11/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xxhdpi-v11/ic_question_answer.png
About to copy file /Users/mcquadrat/Documents/e-mission-phone/resources/android/ic_question_answer/drawable-xxhdpi-v9/ic_question_answer.png -> /Users/mcquadrat/Documents/e-mission-phone/platforms/android/res/drawable-xxhdpi-v9/ic_question_answer.png
Running command: /Users/mcquadrat/Documents/e-mission-phone/package-hooks/ios9_allow_http.sh /Users/mcquadrat/Documents/e-mission-phone
ANDROID_HOME=/Users/mcquadrat/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home
Reading build config file: /Users/mcquadrat/Documents/e-mission-phone/build.json
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_5skcuj3489xz0l4xtauomurti.run(/Users/mcquadrat/Documents/e-mission-phone/platforms/android/build.gradle:144)
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android

* 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:57999) UnhandledPromiseRejectionWarning: Error: /Users/mcquadrat/Documents/e-mission-phone/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'.
> No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android

* 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
    at ChildProcess.whenDone (/Users/mcquadrat/Documents/e-mission-phone/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at ChildProcess.emit (events.js:160:13)
    at maybeClose (internal/child_process.js:943:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:57999) 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:57999) [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 is probably because the android platform folder is "out of the box" with an older version of the build tools.

I will try removing the android platform and re-adding it with cordova

@st-patrick
Copy link
Contributor Author

Ok so I literally cannot build the latest master commit for Android (haven't even tried iOS yet) which is, as far as I can tell, due to a ton of deprecated dependencies like Java 6, location services 11, gradle 2 and so on and so on and there is no telling, in how many places I will have to replace those to get the build running.
It's also honestly a little hard for me to wrap my head around the fact that it works perfectly in "serve" configuration, so UI development mode with the cordova devapp.

Hence my question:
@shankari @PatGendre

Is any one of you able to build the current latest commit on master for the e-mission-phone?
I have been working on only this one android build for over 10 hours now and it just keeps on throwing new Errors at me.

Here is the specific list of steps I go through:


  1. clone e-mission/e-mission-phone repo

  2. do all the Apple ID and firebase setup stuff:

    1. create a new appid in apple (https://developer.apple.com) with the new id specified in step 2
    2. the current version of the push plugin requires firebase to be configured even if you are not using it
      ◦ create a new firebase project for the new package (https://console.firebase.google.com)
      ◦ set up an iOS app with the new appid from the previous step
      ◦ go to Settings -> Cloud Messaging
      ◦ upload your APNs Authentication Key (create one from the apple developer account under Keys -> APNs key if you don't have one)
      ◦ get the google-services.json and GoogleService-Info.plist and put them into the project root
      ◦ Setting up Firebase for both Android and iOS is necessary, even if you only need one platform to work.
  3. open a terminal and make sure you have all the right versions of node, npm, Cordova and Ionic in that session with node -v, npm -v etc…
    It must be
    Node 9.4.0
    Npm 6.0.0
    Cordova 8.0.0
    Ionic 3.19.1

cd into your project folder, wherever you cloned into

  1. platform hooks install
    git clone https://github.com/driftyco/ionic-package-hooks.git ./package-hooks

  2. ./bin/configure_xml_and_json.js cordovabuild

  3. bower update

  4. npm install

  5. All the cocoa pods stuff:
    sudo gem install cocoapods
    pod setup

  6. set up config values:
    cp www/json/connectionConfig.physical_device2localhost.json.sample www/json/connectionConfig.json
    nano www/json/connectionConfig.json
    … insert IP of our server http://134.209.237.178:80

this is our current setup, we don't use google auth for now but would like to in the future. It shouldn't stop us from building the apk though, right?

  1. change the permission of hooks/before_prepare/download_translation.js file to be executable
    chmod a+x hooks/before_prepare/download_translation.js

  2. change package name and version numbers in package.json and config.xml
    Make sure to get:
    package name (com.mcqdev.emission)
    App Name (DFKI emission)
    Version (1 or 0.0.1)

  3. run $ cordova prepare

12.2) then some more cocoa iOS setup stuff:

cd platforms/ios
pod install
cd ../..
  1. upgrade the class path in platforms/android/build.gradle to 3.1.2 like mentioned here: No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android flutter/flutter#22031
    Currently line 35: classpath 'com.android.tools.build:gradle:3.1.2'

I’m assuming the gradle version in line 50 must be updated accordingly:
task wrapper(type: Wrapper) {
gradleVersion = ‚3.1.2‘
}

Also change the distribution URL as mentioned here: https://stackoverflow.com/questions/37125496/cordova-build-changes-distributionurl-in-gradle-wrapper-properties-file
Go to file platforms/android/cordova/lib/builders/GradleBuilder.js
Check var distributionUrl =
Currently line 199
And change it to e.g. 4.4: gradle-4.4-all.zip

  1. now build with
    cordova build android --release -- --minSdkVersion=21

I have also tried to upgrade the google play location and auth services versions and upgrading the Jsva version to 8 in build.gradle:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

I couldn't tell from the error output whether that helped or not.

Also, I was wondering, what does this mean?
copy over the hooks (./hooks) and any notification icons needed (resources/android/*)
should I copy the entire hooks folder into the platforms folder?

Here is my current error output that I get using the steps described above, in case that helps. I cut out the first couple hundred lines, since they seemed to repeat the same errors but I can maybe paste them into an external tool like pastebin if that helps.

65 errors, 0 warnings
/Users/mcquadrat/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.6/9180733b7df8542621dc12e21e87557e8c99b8cb/gson-2.8.6.jar: D8: Illegal class file: Class module-info is missing a super type.
com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/mcquadrat/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.6/9180733b7df8542621dc12e21e87557e8c99b8cb/gson-2.8.6.jar
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
	at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
	at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
	at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:308)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
	at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/mcquadrat/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.6/9180733b7df8542621dc12e21e87557e8c99b8cb/gson-2.8.6.jar
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:805)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$8(DexArchiveBuilderTransform.java:730)
	at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
	at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:175)
	at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:152)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:800)
	... 6 more
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
	at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:76)
	at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:45)
	at com.android.tools.r8.D8.run(D8.java:88)
	at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:147)
	... 7 more
Caused by: com.android.tools.r8.utils.AbortException
	at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:77)
	at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:58)
	at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:67)
	... 10 more


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexBuilderForRelease'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/mcquadrat/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.6/9180733b7df8542621dc12e21e87557e8c99b8cb/gson-2.8.6.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s
    at ChildProcess.whenDone (/Users/mcquadrat/Documents/repos/e-mission/e-mission-phone/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at ChildProcess.emit (events.js:160:13)
    at maybeClose (internal/child_process.js:943:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:71431) 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:71431) [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.

@shankari
Copy link
Contributor

@st-patrick I just rebuilt from a freshly checked out copy of master.

cordova prepare ran correctly after the three following steps:

  • chmod 755 hooks/before_prepare/download_translation.js
  • cp ~/e-mission/e-mission-phone/google-services.json .
  • cp ~/e-mission/e-mission-phone/GoogleService-Info.plist .

However, on cordova build android, I get the same error that you have above.

com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/shankari/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.6/9180733b7df8542621dc12e21e87557e8c99b8cb/gson-2.8.6.jar

I have not seen this error before, but I have also not rebuilt since after the i18n changes that @DO3B checked in. Let me see if I can figure out how to fix it.

@shankari
Copy link
Contributor

I have also tried to upgrade the google play location and auth services versions and upgrading the Jsva version to 8 in build.gradle:

You should not need to upgrade the google play location and auth services versions since the error is in gson.jar, which is only used by data collection.

@shankari
Copy link
Contributor

This appears to be an issue with using java 1.8 instead of java 1.6 (https://stackoverflow.com/questions/47136718/errorcom-android-builder-dexing-dexarchivebuilderexception-failed-to-process-g). I think this means that the the dependency (gson.jar) is compatible with java 1.8.

However, all our code uses java 1.6. I see that you also found this and tried to fix it with

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

But the gradle files are autogenerated! Since this is a cordova app, everything in platforms is autogenerated and can potentially be regenerated on the next cordova build. And the CordovaLib plugin explicitly sets version 1.6, and we are not gonna update the cordova version until #465

$ grep -r sourceCompatibility .
./platforms/android/cordova/lib/plugin-build.gradle:        sourceCompatibility JavaVersion.VERSION_1_6
./platforms/android/build.gradle:        sourceCompatibility JavaVersion.VERSION_1_6
Binary file ./platforms/android/.gradle/4.1/taskHistory/taskHistory.bin matches
./platforms/android/CordovaLib/build.gradle:        sourceCompatibility JavaVersion.VERSION_1_6
./node_modules/cordova-android/bin/templates/cordova/lib/plugin-build.gradle:        sourceCompatibility JavaVersion.VERSION_1_6
./node_modules/cordova-android/bin/templates/project/build.gradle:        sourceCompatibility JavaVersion.VERSION_1_6
./node_modules/cordova-android/framework/build.gradle:        sourceCompatibility JavaVersion.VERSION_1_6

I would say that the safer option is to downgrade gson if possible. Let us see which version of gson we used to use back when this was working.

@shankari
Copy link
Contributor

Looks like it was 2.8.5, not 2.8.6.

$ find platforms/ -name \*gson\*
platforms//android/build/intermediates/splits-support/debug/split-list.gson
platforms//android/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_5_jar.xml

@shankari
Copy link
Contributor

After forcing the use of 2.8.5, the compile works.

:compileDebugSources
:transformClassesWithDexBuilderForDebug
:transformClassesWithMultidexlistForDebug
:transformDexArchiveWithDexMergerForDebug
:transformNativeLibsWithMergeJniLibsForDebug
:transformResourcesWithMergeJavaResForDebug
:packageDebug
:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL in 13s
45 actionable tasks: 43 executed, 2 up-to-date
Built the following apk(s):
	/private/tmp/e-mission-phone/platforms/android/build/outputs/apk/debug/android-debug.apk

@shankari
Copy link
Contributor

shankari commented Nov 29, 2019

I forced the use of 2.8.5 by changing this line of the plugin.xml
https://github.com/e-mission/e-mission-data-collection/blob/master/plugin.xml#L115
in my clone of the repo to

    <framework src="com.google.code.gson:gson:2.8.5"/>

and manually removing and re-adding it

$ cordova plugin rm edu.berkeley.eecs.emission.cordova.datacollection
$ cordova plugin add ~/e-mission/e-mission-data-collection/
$ cordova prepare

This explains why @PatGendre and I haven't seen this before, it is related to a minor release update in the gson library that was released in Oct (https://github.com/google/gson/releases/tag/gson-parent-2.8.6)

If you use the same steps, you should be able to fix the build.

I will release a new version of the plugin with this fix, but I don't have the time to do so right now. In particular, I have other partially pending changes for that plugin, and I don't remember which I have checked in and which I have not. And I have other higher-priority tasks that I must complete before mid-December.

If you urgently need an official update before then, we may be able to get @sunil07t to work on this for an hourly fee. But no guarantees, since he may be busy too.

@st-patrick
Copy link
Contributor Author

st-patrick commented Nov 29, 2019

Hi!
Thank you for the quick response.

All 3 APKs are now generated and as far as I can tell also signed and aligned with the given script.

Nevertheless, none of them install on my Samsung Galaxy S8+ or on my Android Virtual Device, which is the standard Nexus 2. The installation simply ends with "App could not be installed"

At this point I really wouldn't even know where to look for the error anymore. I would assume, though, that it has something to do with the build settings and not the app itself, since I was able to create an installable (yet not functional, since it lacked all plugins) apk yesterday from the "serve" app.

I also do not get any error message while trying to install. Maybe I can access a sort of AVD console somehow to see more output, I'll look for that.

@st-patrick
Copy link
Contributor Author

ok, so I switched to a public version of the "serve" version and so that'll work with Android but trying to build the devapp for ios, I get errors:

Reading build config file:

Error: Cannot read property 'toLowerCase' of undefined



npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phonegap-app-developer@ phonegap: `npm run build:setup && phonegap --verbose "build" "ios"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phonegap-app-developer@ phonegap script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mcquadrat/.npm/_logs/2019-11-29T12_30_46_668Z-debug.log

@st-patrick
Copy link
Contributor Author

it seems this is a bug with the old cordova-ios version: apache/cordova-ios#647

is it safe to upgrade this?

@shankari
Copy link
Contributor

All 3 APKs are now generated and as far as I can tell also signed and aligned with the given script.

If you are OK with supporting only Lollipop+ then you only need one apk.

At this point I really wouldn't even know where to look for the error anymore.

Install from the command line (e.g. adb install <apk>) and a detailed error will show up on your console.

@shankari
Copy link
Contributor

I explored using the newer version of cordova earlier (in #437), but as you can see, then the ionic deploy plugin fails. So if you need to upgrade to cordova-ios@5.0.0, I would suggest removing the ionic-deploy plugin and then everything should work.

That issue has the list of other minor fixes I needed to make to get it to work with cordova-ios@5.0.0. Note that several of the build issues listed in the README disappear with the migration to cordova-ios@5.0.0, so it is a good change overall. I just don't have the time right now to do it right and update all the docs.

@st-patrick
Copy link
Contributor Author

Alright I will soon look into the adb debugging. Regarding ios, I tried installing the newest .app release from em-devapp repository with the Apple Configurator 2, but it didn't work on our iPhone 6 with iOS 12. I tried signing it with our certificates, too but to no avail. Is there anyone who can currently build the em-devapp on their system and could provide a newer .app file?

@shankari
Copy link
Contributor

shankari commented Nov 29, 2019

Regarding ios, I tried installing the newest .app release from em-devapp repository with the Apple Configurator 2, but it didn't work on our iPhone 6 with iOS 12.

em-devapp works fine on the emulator, but prior users who have tried to deploy using the configurator were unsuccessful as well.
e-mission/e-mission-phone#581

Which is why the devapp README doesn't give instructions on how to deploy the .app directly to a device. If you want to use that approach, you are on your own.

When I test on a physical iPhone, I rebuild the app from scratch and deploy directly from xcode. That is the only mode that is known to work.

@shankari
Copy link
Contributor

shankari commented Nov 30, 2019

Note also that the phonegap-devapp, which is what e-mission-devapp is based on, does not even release a .app. Since they are no longer in the store https://twitter.com/phonegap/status/1011679673116327936, their recommendation is to rebuild from scratch using phonegap build. So that is my recommendation as well.

If you do figure out how to make it work with the Apple Configurator, please send a PR with the exact instructions...

@st-patrick
Copy link
Contributor Author

I just tried to create a Testflight project for the iOS devapp. It says that the id edu.berkeley.eecs.emission.devapp already exists (makes sense). Is there any way you could provide us the iOS em-devapp via Testflight?

We need to deploy a working version for iOS and since the builds are not working out of the box right now we are looking for any other way to be able to distribute to an alpha tester group.

@st-patrick
Copy link
Contributor Author

also, if that is not an option, can you provide the last commit that you built for iOS on? That way I can try to rebase our changes to that commit and hopefully build from there.

@shankari
Copy link
Contributor

shankari commented Dec 2, 2019

We need to deploy a working version for iOS and since the builds are not working out of the box right now we are looking for any other way to be able to distribute to an alpha tester group.

also, if that is not an option, can you provide the last commit that you built for iOS on? That way I can try to rebase our changes to that commit and hopefully build from there.

The issue is not with updates to the code, but with updates to xcode and the underlying dependencies, similar to the android issue that you reported earlier. Native compilation is extremely dependent on exact versions as you saw earlier. Using the most recent versions will not work.

Note that README says:

Note about Xcode >=10 The cordova build doesn't work super smoothly for iOS anymore. Concretely, you need two additional steps:

Also, on Mojave, we have reports that you may need to manually enable the Legacy Build system in Xcode if you want to run the app on a real device.

You probably have Xcode 11 and Catalina, which has even more incompatible changes.

Using an older version of xcode should resolve these issues. I can't currently run my xcode because I don't have enough disk space 😦 , but I seem to have version 10.3 installed. You could try with that version and the checked in cordova-ios and see if it works.

@PatGendre can you ask Yann what version of xcode he used? @jf87 do you remember which version of xcode you used to build the app?

@shankari
Copy link
Contributor

shankari commented Dec 2, 2019

Alternatively, you can upgrade to cordova-ios@5.0.0 according to the instructions at #437 and that should work more smoothly.

@st-patrick
Copy link
Contributor Author

ok so the problem with the apk was that the dependencies were conflicting with em-devapp. I remembered this from emission conflicting with devapp but didn't think it would matter once I changed the package name. It did, though, this was the error output from adb install:

adb: failed to install platforms/android/build/outputs/apk/debug/android-debug.apk: Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/com.mcqdev.emission-jnk9N_Z9YgMRZvNyYj0OOg==: Can't install because provider name edu.berkeley.eecs.emission.provider (in package com.mcqdev.emission) is already used by edu.berkeley.eecs.emission.devapp]

So far I was able to build the master commit we built on so I should be able to build our own commit, too. After that only iOS is left as problem (again^^)

@shankari
Copy link
Contributor

shankari commented Dec 2, 2019

wrt provider conflict, you need to make the changes at #406
I didn't merge that PR because of the other changes included in it, but the provider name change is all you need. If you can pull out the provider name change into a separate PR and submit it, I would be happy to merge

@PatGendre
Copy link
Contributor

@shankari @st-patrick FYI we currently use Xcode V 10.2.1

@jf87
Copy link
Contributor

jf87 commented Dec 3, 2019

Regarding xcode issues. I solved the issues before with using multiple xcode versions. One to move the code to the new Swift version and another to then open the same project and compiling it for new iOS targets. However, the last time I wanted to create a build I ran into some other issues and because there was no immediate need for us to have a new build, I kind of put solving this off for now. Generally, I feel that the build process is a bit hard to control from my side. I am no expert on cordova and iOS/Android builds, so I always struggled a bit when I created a new build for various reasons. In the future, we might think about how to improve this---if possible ;-)

@shankari
Copy link
Contributor

shankari commented Dec 3, 2019

@jf87

In the future, we might think about how to improve this---if possible ;-)

I think that the way to improve this in the future is to have proper automated builds and dedicated maintenance resources. On every new release of xcode/OSX, the maintenance person would check the automated build and fix all issues (likely to be minor) until the build succeeded again. Unfortunately, we don't currently have such a maintenance person due to lack of funding.

I hope that orgs that rely on e-mission can make some contributions towards ongoing maintenance. The idea is that the community pools its resources to keep the software up to date. This can be either monetary contributions (to hire a maintenance person) or code contributions in terms of PRs.

@jf87
Copy link
Contributor

jf87 commented Dec 3, 2019

Yes, fully agree.

@shankari
Copy link
Contributor

shankari commented Dec 3, 2019

@st-patrick you have three options for iOS

Once you have it working, please submit a PR with the fix 😄

@shankari
Copy link
Contributor

shankari commented Dec 6, 2019

@st-patrick any updates on this?

We need to deploy a working version for iOS and since the builds are not working out of the box right now we are looking for any other way to be able to distribute to an alpha tester group.

I forgot to ask you earlier - have you tried using a custom skin with emTripLog? LMK if you would like me to create a branch for you.

@st-patrick
Copy link
Contributor Author

I haven't had the chance yet because we are now focusing on finishing up a stable Android version but I will get back to you as soon as we start working on iOS again.

@shankari
Copy link
Contributor

I explicitly changed the message on shankari/e-mission-phone@f5b9a7f so it wouldn't auto-close it. But github closed it anyway.

@shankari shankari reopened this Feb 27, 2020
shankari added a commit to shankari/e-mission-docker that referenced this issue Mar 1, 2020
This packages all the correct build dependencies and makes it less likely to
have issues similar to e-mission/e-mission-docs#475 (comment) or e-mission/e-mission-docs#290
@shankari shankari reopened this Mar 30, 2020
@shankari
Copy link
Contributor

Not all issues are resolved!

@shankari
Copy link
Contributor

shankari commented Aug 6, 2020

Fixed in e-mission/e-mission-phone#707
Builds now work, we are at API 29, and we have CI enabled.
Finally closing this.

@shankari shankari closed this as completed Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants