Posts in Category "Packaging"

Versioning of multiple APKs for Android

Recently, with AIR 14, we announced x86 support for AIR applications. In this article, we explain how should developers manage the binary upload on Google Play Store for ARM and x86 binaries. Android devices are available with three kind of architectures – ARM, x86 and devices which support both x86 and ARM architectures (Eg: Samsung Galaxy Tab 3 10.1). AIR SDK (14.0.0.125 beta onwards) allows developers to create separate APK files for ARM and x86 architectures. And Google Play Developer console provides CPU architecture (ABI) as a filter criteria to support multiple APKs for the same application. The way Adobe AIR developers should make use of this filter criteria would depend on the packaging mode – captive or shared.

 

For Apps packaged with Captive mode

Please take a look at the following documentation. AIR developers should follow the same guidelines, as are mentioned for native applications.

http://developer.android.com/google/play/publishing/multiple-apks.html

Assigning a higher versionNumber  (in application descriptor) for the x86 version of apk would ensure that the Google Play serves x86 binary to devices with both x86 and ARM support,  thereby resulting in better performance.

 

For Apps packaged with Shared mode

After the recent release of x86 support in AIR, Play Store will have two different binaries for AIR Runtime app– one for ARM devices, and another for x86 devices. For devices which can run both, ARM binary version would be preferred because that used to get downloaded even before we introduced x86 support. And we plan to continue with the same preference to ensure that shared apps dependent on AIR runtime aren’t affected. To align with AIR Runtime app, applications packaged in shared mode should also keep their x86 based binary with lower versionNumber. With this approach, if you face any performance related issues on devices which support both the processors, then you can opt for captive mode of packaging.

The table below summarizes what version gets downloaded on device with different processors type.

  ARM Device x86 Device Device supporting both x86 and ARM
Runtime.apk ARM version x86 version ARM version
Captive App ARM version x86 version x86 version
Shared App ARM version x86 version ARM version

-Thanks

Multiple ANEs and conflicting resources

AIR 4.0 and later supports packaging of multiple JAR files in an ANE. That allows packaging of third party libraries and their corresponding resources an ANE.

The resources bundled in an ANE or any other library in the ANE can be accessed by R* method, and this document provides all the details.

This post talks about a scenario where multiple ANEs are used in an app and if two or more of the ANEs use same JAR file as a dependency (packagedDependency).  It is not possible to create such an app, and the packager fails with following error –

unexpected failure: duplicate entry: /R.class

This is expected because when the packager picks up resources of all the ANEs, and finds that two or more ANEs are using a same resource, the step to convert *.java to *.class file fails with a duplicate entry error. This is something which the packager cannot resolve by itself, and the developer has to step in.

If you face this packaging error, you need to remove the common JAR from all of the ANEs but one, to ensure that the packager finds a single copy of every JAR file as input.

Here is an example –

Suppose there are two ANEs used in an app i.e. example1.ane and example2.ane. Both of them use a common library, say commonlibrary.jar, and its resources, say, common-lib-res. If you try to package the app with these ANEs, ADT throws an error –

unexpected failure: duplicate entry: com.common.example.lib/R.class

To resolve the issue, you need to follow these steps (eg. is for a Mac) –

1. Copy example1.ane in a temp folder.

2. Unzip example.ane (run command ‘unzip example1.ane‘)

3. Remove the commonlibrary.jar from the package (i.e. from unzipped content of the ANE).

4. Remove the corresponding resources of commonlibrary.jar (i.e. “common-lib-res“) from the package.

5. In platform.xml, delete the entry for commonlibrary.jar from the tag and delete the entry of the common-lib-res from the tag.

6. Zip back contents of package to ANE –

  • zip –r –D example1.zip META-INF catalog.xml library.swf mimetype
  • rm –rf example1.ane META-INF catalog.xml library.swf mimetype
  • mv example1.zip example1.ane

Use this new temp/example1.ane and existing example2.ane to package the APK file. You should not see any packaging or runtime error now.

Hope that helps! :)

External hosting of secondary SWFs for AIR apps on iOS

Starting with AIR 3.7, application developers will be able to host their secondary SWFs on an external server and load them on demand as per their application logic.

Till AIR 3.5, loading of only assets such as images, videos and SWFs without actionscript code, commonly referred as Actionscript Byte Code(ABC Code), from external server was supported. The workflow for the application developer for loading such assets from server resembles the diagram below :

 AIR 3.5 Workflow

With AIR 3.6, the feature for loading of locally packaged secondary SWFs containing ABC code was introduced. The detailed description about this feature and its usage can be found at this blog – “Packaging and loading of multiple SWFs for AIR apps on iOS“. The workflow for the application developer using this feature is described in the diagram below:

Continue reading…

Packaging and loading multiple SWFs in AIR apps on iOS

In AIR SDK 3.6 for iOS, there is a new feature that allows application developers to be able to package and load secondary SWFs that contain ActionScript byte code (or ABC) in their apps. Presently, due to certain restrictions on iOS, AIR on iOS requires that all the ActionScript code of an application be present in the main SWF or the root SWF. With this feature, an application developer can have ActionScript code in local secondary SWFs and package them along with the main SWF.

Continue reading…

AOT Compilation Optimization

This post will talk about a small optimization that developers can do within their code to reduce the amount of time taken for AOT compilation of their application I would recommend developers to read this post to understand what is meant by AOT compilation.

One of the intermediate steps in AOT compilation requires LLVM to process the LLVM bytecode and to optimized LLVM bytecode. In case one of your function has a lot of actionscript code (~30000 lines) then the corresponding LLVM code is around 1.3 million lines. LLVM is known to perform badly (compilation time) on large functions. As a recommendation, actionscript developers should break down on large function into smaller functions to reduce the AOT compilation time. They need not change any code, just break a large function into many smaller functions to reduce AOT compilation time significantly.