Updating an AIR Project using APM

How to update an application using air packages

Michael
Michael
Oct 28 · 4 min read

In this tutorial we are going to run through how to update an application that has been setup to use the AIR Package Manager.

This assumes you have got your AIR project running with `apm`. If you haven’t have a look at the following tutorials:

Updating a project that has been setup with is one of the most powerful things about the AIR Package Manager.

Previously you would have had to go to the site distributing the ANE, download the ANE, check for updates to any dependencies and download them. Then you would have to check the documentation and sift through your manifest additions and info additions to check if any updates are required. This is all before you can even start to check for any code changes required. Obviously it was a painful process and one we at distriqt were all too aware of.

So lets look at what we do with .

In this example I have 2 packages installed:

My Application@1.0.0 /Users/marchbold/work/myapp
├──com.distriqt.facebook.Core@9.3.1
└──com.distriqt.IDFA@5.0.31

Outdated Packages

Firstly we can quickly see if there is an update available by using the command:

apm outdated

This check the installed packages for updates in the repository:

$ apm outdatedidentifier                  installed    available
com.distriqt.facebook.Core 9.3.1 9.3.2
com.distriqt.IDFA 5.0.31 5.0.31

From this we can see that there is a new version of the package available. It is a patch release (last digit in the sem ver) so will only contain bug fixes and minor updates and shouldn’t require any changes to the API (though there may be manifest changes or other such additions).

Using isn’t necessary, it is just information that you can use to decide whether you want to update or not.

Update Packages

Now that we know there is an update and we have decided to update our packages we move to the command.

Open up a terminal in the project directory, and run the process to print out the details on the update command:

$ apm help updateapm updateupdate the installed packages in your projectapm update apm       check for a new release of the apm client and update if available
apm update update all dependencies in your project
apm update <foo> update the <foo> dependency in your project

You will see there are several options here, the first is to update the `apm` client (more on this later). The other commands allow you to update packages. If you pass a parameter you can specify a package to update, eg:

apm update com.distriqt.IDFA

would check to see if there are any updates to the IDFA extension and install them if available.

Alternatively you can just run update without any parameters:

apm update

This process will firstly check with the repository for the latest versions of all your packages and then update them as required.

Lets run this now.

apm update

You will see going through and checking the versions of all the extensions, uninstalling old and unused extensions, then installing the newer versions.

Once complete you should be able to list your installed packages and see:

My Application@1.0.0 /Users/marchbold/work/myapp
├──com.distriqt.IDFA@5.0.31
└──com.distriqt.facebook.Core@9.3.2

Here we can see the facebook package is now at the updated 9.3.2 release.

Finalising

When you update (or install) a package you should always regenerate your application descriptor. This makes sure any changes to the android manifest or the ios info additions and entitlements are correctly updated in your build.

$ apm generate app-descriptor src/MyApplication-app.xml
✓ Merge tool available
Android package name: air.com.my.app
✓ Android manifest merge
✓ iOS additions merge complete
✓ iOS entitlements merge complete
✓ App descriptor generated: /Users/marchbold/work/myapp/src/MyApplication-app.xml

Now we can return to our application and check it builds and runs as expected.

Summary

Updating is easy with , simply run:

apm update

and then regenerate your application descriptor:

apm generate app-descriptor

and you are done!

Advanced: Updating APM

It is worth ensuring you have the latest version of installed. This is done through a specific form of the command:

apm update apm

This will list out the current version and then check for the latest. It will then download any updates to the application and install.

apm: v0.0.8-beta
✓ Found new release: 0.0.9-beta
✓ Install complete

If you have the latest you will see something like the following:

apm: v0.0.9-beta
✓ Already at latest version

Thanks for reading and if you have any questions you can reach out at the apm discussion forum.

Native Extensions

Native Extensions Articles and News