Development environment: FlashBuilder4.7 AIR13.0 Eclipse
Since I am too lazy to accompany the development environment of Android, I downloaded Eclipse, which contains Android SDK manager, but it is also possible to develop ANE directly with Flashbuilder, since debugging is needed later, Personally, it is more convenient to use Eclipse and Flashbuilder for collaborative debugging. First of all, I have to say that the production of ANE is far less than the requirements of the packaging process of the careful requirements, writing this blog when I just finished "Million Hands King" Project access to the Truechina platform ane production, time 2 days, basically encountered a large and small countless pits, This article mainly records what needs to be noted during the development of the ANE and how to use Eclipse and Flashbuilder together to debug the Android Ane native code. Since Adobe's AIR13.0 has done a good job of optimizing the packaging of ane, it does not require manual merging of jar files and can support r* mode for resources, which is a boon for the developers of ANE. This article does not introduce some of the basic programming of ANE, here is an official Adobe tutorial http://www.adobe.com/cn/devnet/air/articles/ Ane-android-devices.html The above tutorial is still written in more detail, but some details are not carefully explained, this article is to add to his description. Here's where the ANE package might go wrong. In Extension.xml
In Gamemain-app.xml
In extensioncontext.as
Be sure to keep the ID labeled above consistent. If the inconsistency of course compiles will not error, but your ane must not run up.
Be sure to include a description of the permissions and activity in the gamemain-app.xml, and be sure to keep it consistent with the SDK, if errors and leaks can cause the program to collapse or the ANE will not respond to problems.
Here are some things to keep in mind when packaging a jar file:
Note that the above-mentioned places need to be a library file first, and then import the SDK library.
write the code to fetch the *.jar in the bin directory, which is the most clean jar file.
As library attention to the problem, he had to be a flex library (as library do not know the line, anyway the Flex library is sure to do) ensure that the Adobe Air library is checked!
Here's what you need to package ane here is also the official Adobe documentation http://help.adobe.com/en_US/air/extensions/ Wsf268776665d7970d-2e74ffb4130044f3619-7ff8.html#wsa61fd03d-6f46-4ff9-a77a-9d47c47501f3 This is e-text, the Chinese version of the lack of the following description Really really is said is too simple, the harm I tried many times. The following is a detailed description of AIR4.0 start ane on the Android r* mechanism to provide support, fundamentally solve the resource ID is not correct, third-party package can not read the problem of resources. And you no longer need to manually merge the jar packages: You can put all the jars you need in the same folder except for Flashruntimeextensions.jar, which is automatically added during the ANE package. Here's my packing command @echo off:: Go to current drive letter%~d0:: Open current directory CD%~dp0set flex_sdk= "D:\Program Files (x86) \FLASHDEVELOP\TOOLS\FLEXSDK \bin\adt.bat " %flex_sdk%-package-target ane com.tmtbe.truechina.ane EXTENSION.XML-SWC TRUECHINAANEAS.SWC- Platform Android-arm-platformoptions platform-android.xml-c Android. -platform default-c Default . can find more than one parameter called -platformoptions and a corresponding platform-android.xml from the package command. The structure of the platform-android.xml is described in detail below. First put out an example <platform xmlns= "http://ns.adobe.com/air/extension/13.0" ><description>an optional description.</description><copyright>2011 (optional) </copyright><packageddependeNcies><packageddependency>alipay.jar</packageddependency><packageddependency> android-support-v4.jar</packageddependency><packageddependency>true_sdk_lib.jar</ packageddependency></packageddependencies><packagedresources><packagedresource>< packagename>com.alipay.android.app.sdk</packagename><foldername>true-res</foldername>< The/packagedresource></packagedresources></platform> <packageddependencies> tag corresponds to all dependent libraries is to place all jars in the Jar folder except for the jar that we wrote for AS and Java Bridge functions. (That's why you need to manually pack the jar) the <packagedResource> tag describes which package corresponds to what resource. This is important. Fill in this to support the r* mode to get resources. <packageName> corresponds to a package name, ADT generates an additional R.java in this package. So that the third-party package can get the resources through r* <folderName> a folder name, (the name is not limited to customize) This folder contains all the resources needed to <packageName> this package. Fast positioning of package names in <packageName>: third-party libraries in/gen can quickly see this r.java position. So my <packageName> filled in the com.alipay.android.app.sdk. We decompile the APK to discover that the ADT will generate a-platformoptions after we have defined the <packageName>An additional r so that our third-party library can get the resources. This is the r of air this is the extra r generated from XML this is the next article, which describes the debugging of native code.
Ane Access Platform Experience record (Android)