When Adobe AIR Native Extensions were first introduced, implementing them in AIR apps were easy. because the number of available ANEs were limited and they were doing limited work. Today, it’s very hard to think an AIR app can succeed without using any ANEs! ANE Setup is becoming very confusing.
Imagine, the Firebase ANEs. Check out the implementation setup menu. It’s confusing and time-consuming. I’m sure we all agree on that. To avoid wasting time, we developed the ANELAB software. But still, there are some developers who have not joined the Myflashlabs Club so they can’t use the software. If you are reading this, it’s very likely that you are one of those developers 🙂 So, keep on reading because this post is for you.
When we started to develop ANELAB, we needed a solution for every ANE to somehow tell ANELAB how it must be implemented. To do this, we used the extension.xml file which is found in all ANEs. We invented a JSON specialized format which any ANE can use and the ANELAB software can read and understand how that ANE must be implemented in the project.
The above instruction tells you that the minimum AIR SDK to compile this ANE is V30 and also you must make sure to set the -swf-version of your app to at least 36. It also tell you that this ANE will run on iOS devices 8.0 and above. Alike, it tells you that Android devices with API version lower than 15 cannot run this ANE.
On line 6, we have an Array “platforms” which holds two objects, one for Android and another for iOS. This tells you that this ANE supports Android and iOS and also there are some settings you need to do on each platform. Let’s check out the android platform first.
On line 9, we have an Array “dependencies”. It tells you that this ANE cannot run unless the listed dependencies are also included in your project. You can find all the available dependency ANEs from Myflashlabs, here: https://github.com/myflashlab/common-dependencies-ANE
When listing the dependency ANEs, it also tells you the minimum version number of that dependency which you must use. You can use higher versions and it will be fine but you must never use lower versions.
On line 15, we have an Array “manifest”. This tells you what changes you must make to your manifest .xml file. In this example, it tells you that you must add one new node to your manifest.
NOTICE: It is very important to remove the extra back-slashes when you are copying the node to your app’s manifest .xml file
The good thing is that it also tells you where exactly to put the new node with the help of line 18 and 19. Line 18, tells you that the parent xml node of our tag is named manifest, So, you just need to located the manifest tag in your manifest .xml file and add the note to it. Let me give you a quick other example. if the parent value was manifest.application, then you could know that you should look for the application tag which itself is already under the manifest tag. So, you should have added the node under that application tag. We will give you more examples to know this locations better.
Ok, great, you are done with the android side. Let’s move on to the iOS side. Well, the iOS side has only one dependency and you’re good to go.
Congratulations! you have just been able to do what ANELAB is meant to do. All it does is to read these instruction blocks and automatically edit your app’s manifest file on your behalf. But don’t get too much excited. The sample instruction setup you saw above was a simple example to get you familiar with the overall format. Let’s now check out the instruction of the Firebase Core ANE.
On line 6, we have inputValue, ANELAB uses these inputValues to ask you for some values so it can place those values in appropriate locations in the manifest. Here on line 11, we have a shortcode being known as [APP_SCHEME]. This is just a place holder and the actual value must be replaced in the manifest in all places where the shortcode name is used. If you check the above instruction, you will see that on line 125 this shortcode has been used. So you know you must include the actual value instead of the String [APP_SCHEME].
Every inputValue or as we call them shortcode, has a description (line 10) which tells you what value must be used for this item.
It’s worthy to mention that the value of some common shortcodes are generated automatically by the ANELAB. For example, the shortcode[PROJECT_ID] on line 115. ANELAB automatically changes this shortcode with the package id of your application. it could be air.com.site.app for instance. So, everytime you see the [PROJECT_ID] shortcode, replace it with your app package name.
On line 190, we have applicationAtt; Android tags could have attributes and some ANEs may require different attributes. in our example, we know that we must add a new attribute to the application tag of our Android setup. The name of this attribute must be “name” as indicated at line 192 and its value must be “android.support.multidex.MultiDexApplication“ as indicated at line 193.
Now, let’s check out the iOS side. on line 205, we have an Array of frameworks. Our ANE depends on these frameworks to be able to compile. These frameworks must be copied to your AIR SDK/lib/aot/stub directory. And you know where to download them. Look at line 208, there is a url which you should download and extract in your computer, then look for the “FirebaseAnalytics.framework” file as mentioned at line 207. The same thing is true for all the other framework files. You should find them one by one and copy them to your AIR SDK/lib/aot/stub directory.
Some ANEs, may have some extra configurations which if they do, they will notify you on ANELAB using something like what you see On line 251, If you are doing things manually, you should be able to read these notes. We have urlencoded them so they won’t break the ANE and they will be decoded in ANELAB. However, it’s easy to read them. copy it first “%3Cp%20align%3D%22left%22%3EBefore%20installing%20the%20Firebase%20Core%20ANE%2C%20you%20should%20have%20setup%20your%20Firebase%20app%20on%20%3Cfont%20color%3D%22%23990000%22%3E%3Ca%20href%3D%22https%3A%2F%2Fconsole.firebase.google.com%22%3Efirebase%20console%20page%3C%2Fa%3E%3C%2Ffont%3E.%20When%20that%20step%20is%20completed%2C%20you%20should%20download%20your%20Firebase%20configuration%20files.%20They%20are%20named%20%3Cfont%20color%3D%22%23990000%22%3Egoogle-services.json%3C%2Ffont%3E%20for%20Android%20and%20%3Cfont%20color%3D%22%23990000%22%3EGoogleService-Info.plist%3C%2Ffont%3E%20for%20iOS.%20These%20files%20must%20be%20packaged%20at%20the%20root%20of%20your%20app%20just%20like%20any%20other%20resources.%3C%2Fp%3E” and decode it here: https://meyerweb.com/eric/tools/dencoder/ it’s a simple html block which now you can understand.
Understanding ANE Setup instruction
When Adobe AIR Native Extensions were first introduced, implementing them in AIR apps were easy. because the number of available ANEs were limited and they were doing limited work. Today, it’s very hard to think an AIR app can succeed without using any ANEs! ANE Setup is becoming very confusing.
Imagine, the Firebase ANEs. Check out the implementation setup menu. It’s confusing and time-consuming. I’m sure we all agree on that. To avoid wasting time, we developed the ANELAB software. But still, there are some developers who have not joined the Myflashlabs Club so they can’t use the software. If you are reading this, it’s very likely that you are one of those developers 🙂 So, keep on reading because this post is for you.
When we started to develop ANELAB, we needed a solution for every ANE to somehow tell ANELAB how it must be implemented. To do this, we used the extension.xml file which is found in all ANEs. We invented a JSON specialized format which any ANE can use and the ANELAB software can read and understand how that ANE must be implemented in the project.
Take this as a simple example:
The above instruction tells you that the minimum AIR SDK to compile this ANE is V30 and also you must make sure to set the -swf-version of your app to at least 36. It also tell you that this ANE will run on iOS devices 8.0 and above. Alike, it tells you that Android devices with API version lower than 15 cannot run this ANE.
On line 6, we have an Array “platforms” which holds two objects, one for Android and another for iOS. This tells you that this ANE supports Android and iOS and also there are some settings you need to do on each platform. Let’s check out the android platform first.
On line 9, we have an Array “dependencies”. It tells you that this ANE cannot run unless the listed dependencies are also included in your project. You can find all the available dependency ANEs from Myflashlabs, here: https://github.com/myflashlab/common-dependencies-ANE
On line 15, we have an Array “manifest”. This tells you what changes you must make to your manifest .xml file. In this example, it tells you that you must add one new node to your manifest.
The good thing is that it also tells you where exactly to put the new node with the help of line 18 and 19. Line 18, tells you that the parent xml node of our tag is named manifest, So, you just need to located the manifest tag in your manifest .xml file and add the note to it. Let me give you a quick other example. if the parent value was manifest.application, then you could know that you should look for the application tag which itself is already under the manifest tag. So, you should have added the node under that application tag. We will give you more examples to know this locations better.
Ok, great, you are done with the android side. Let’s move on to the iOS side. Well, the iOS side has only one dependency and you’re good to go.
Congratulations! you have just been able to do what ANELAB is meant to do. All it does is to read these instruction blocks and automatically edit your app’s manifest file on your behalf. But don’t get too much excited. The sample instruction setup you saw above was a simple example to get you familiar with the overall format. Let’s now check out the instruction of the Firebase Core ANE.
On line 6, we have inputValue, ANELAB uses these inputValues to ask you for some values so it can place those values in appropriate locations in the manifest. Here on line 11, we have a shortcode being known as [APP_SCHEME]. This is just a place holder and the actual value must be replaced in the manifest in all places where the shortcode name is used. If you check the above instruction, you will see that on line 125 this shortcode has been used. So you know you must include the actual value instead of the String [APP_SCHEME].
Every inputValue or as we call them shortcode, has a description (line 10) which tells you what value must be used for this item.
It’s worthy to mention that the value of some common shortcodes are generated automatically by the ANELAB. For example, the shortcode [PROJECT_ID] on line 115. ANELAB automatically changes this shortcode with the package id of your application. it could be air.com.site.app for instance. So, everytime you see the [PROJECT_ID] shortcode, replace it with your app package name.
On line 190, we have applicationAtt; Android tags could have attributes and some ANEs may require different attributes. in our example, we know that we must add a new attribute to the application tag of our Android setup. The name of this attribute must be “name” as indicated at line 192 and its value must be “android.support.multidex.MultiDexApplication“ as indicated at line 193.
Now, let’s check out the iOS side. on line 205, we have an Array of frameworks. Our ANE depends on these frameworks to be able to compile. These frameworks must be copied to your AIR SDK/lib/aot/stub directory. And you know where to download them. Look at line 208, there is a url which you should download and extract in your computer, then look for the “FirebaseAnalytics.framework” file as mentioned at line 207. The same thing is true for all the other framework files. You should find them one by one and copy them to your AIR SDK/lib/aot/stub directory.
Some ANEs, may have some extra configurations which if they do, they will notify you on ANELAB using something like what you see On line 251, If you are doing things manually, you should be able to read these notes. We have urlencoded them so they won’t break the ANE and they will be decoded in ANELAB. However, it’s easy to read them. copy it first “%3Cp%20align%3D%22left%22%3EBefore%20installing%20the%20Firebase%20Core%20ANE%2C%20you%20should%20have%20setup%20your%20Firebase%20app%20on%20%3Cfont%20color%3D%22%23990000%22%3E%3Ca%20href%3D%22https%3A%2F%2Fconsole.firebase.google.com%22%3Efirebase%20console%20page%3C%2Fa%3E%3C%2Ffont%3E.%20When%20that%20step%20is%20completed%2C%20you%20should%20download%20your%20Firebase%20configuration%20files.%20They%20are%20named%20%3Cfont%20color%3D%22%23990000%22%3Egoogle-services.json%3C%2Ffont%3E%20for%20Android%20and%20%3Cfont%20color%3D%22%23990000%22%3EGoogleService-Info.plist%3C%2Ffont%3E%20for%20iOS.%20These%20files%20must%20be%20packaged%20at%20the%20root%20of%20your%20app%20just%20like%20any%20other%20resources.%3C%2Fp%3E” and decode it here: https://meyerweb.com/eric/tools/dencoder/ it’s a simple html block which now you can understand.
Please support the ANELAB software by joining the MyFlashLabs Club. ❤️
Share this:
Related