It's that time of year again when we need to refresh our app for our annual conference in January. I, for one, like to get everything up to date as possible as part of that refresh so that we're not too far out to lunch but the time the event rolls around. We don't want to be over a year behind on some dependency that breaks in a few months.

So the latest versions of everything in our stack are as follows;

ember-cli 3.5.0
corber 1.3.3
cordova 8.1.2
cordova-android 7.1.1
Android Studio 3.2.1
cordova-ios 4.5.5
Xcode 10.1 - iOS 12.1

So building for Android is very simple, only issues we ran into were the new gradle path and we needed to change it's permissions so that our continuous deployment stack will work for us.
our ~/.bash_profile

export JAVA_HOME=$(/usr/libexec/java_home)
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export PATH="/Applications/Android Studio.app/Contents/gradle/gradle-4.6/bin:$PATH"

I just had to make it executable so that we could run it from the command line, the default permissions.

chmod 755 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.6/bin/gradle

Then our build command is simply:

export ANDROID_HOME=/Users/username/Library/Android/sdk
corber build --platform=android --environment=production --release

The signing data comes out of our keystore file and is handled with our build.json

For Xcode, that's where our biggest changes have happened this year. First of all Xcode has a new build system, and it doesn't work with cordova so we need to disable that, since we're using build.json religiously, we'll just add this:

      "buildFlag": [
        "-UseModernBuildSystem=0"
      ]

to both our "debug" and "release" sections of the "ios" block.

Then once we're building we found the next issue was that our javascript wasn't running. With splash screen plugin enabled this exhibits by the splash screen never going away and just sitting there with the spinner in the middle. Without the splash screen plugin you'll be presented with a plain white blank page. This took some serious time to figure out but I finally stumbled upon the debugging solution. Once your app is running on the device, you can use the Safari Develop menu option and you'll see your device or simulator listed there, you can select your app there to open the inspector and then there's a refresh button in there or you can press Command+Shift+R to refresh and voila! Now you'll get a console of the app loading in the webview. Perhaps, like me, you'll see that the integrity check is failing. I'm sure Xcode is modifying something after the fact which is causing the hashes to be incorrect. So, let's do away with them!

Edit your ember-cli-build.js and add EmberApp block;

  let app = new EmberApp(defaults, {
    SRI: {
      enabled: false
    }
  });

And that's all there is to it! Now your ember/cordova/corber app will build and run like it always did before on the latest versions of everything.

It's worth noting that the cordova team is working on version 5 of the cordova-ios process and will be fixing Xcode 10 support.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>