AIR APK Packaging

Is there a way to specify icons for the AIR APK? (I have looked in the AIR packager dialog and can not find any way to specify which custom icon to use. I created a set of 36x36, 48x48 and 72x72 png icons but can not figure out how to use them for the AIR APK?)

Any help appreciated.

Comment actions Permalink

You can enter the path/file names into the Application descriptor file (myProject.xml)
To see that in the project view you should use a customized one.
For that:

  • select "Poject Structure" and then your AIR mobile Module
  • In the Build Configuration for your module on the right elect the "AIR Package" tab (the right most one)
  • In Application Descritpor check the "Custom template" check box and click "Create"
  • Select your AIR version (e.g. 3.8) and the version of your application and hit OK

After that you'll find a new file myProject-app.xml in the procject view.
Open that file and you'll find all setting options for the deployment.
Search for <icon> and you'll find all tags for the different sizes of the icons prpared (still as commented text).
Uncomment those lines with the icon sizes you want to use and enter path and icon name; relative to your module.
It must be PNG files of the correct size.

With the next creation of the APK file you'll have your icons embedded.

This code will set 3 icons with sizes of 72, 96 and 144 px in size, all located in an images/ folder:

 <!-- <image16x16></image16x16>
 <image58x58></image58x58> -->
 <!-- <image100x100></image100x100>
  <image128x128></image128x128> -->
 <!--  <image512x512></image512x512>
 <image1024x1024></image1024x1024> -->

AIR app descriptor.jpg
Comment actions Permalink

Hans gave the correct answer in general. One correction - in case of mobile-targeted build configuration the tab will be named 'Android', not 'AIR Package'. Also I think you'll need icon files to be included in the resulting APK. Files to package are also configured at 'Android' tab.

Comment actions Permalink

Thank you Hans and Alexander.

I think that I understand, and will try to create an APK with custom icons, following your suggestions.

If I have difficulty, I will write again.

Thank you!

Comment actions Permalink

Oops, you are right; sorry.
I looked at the wrong package with a different configuration... But by chance you gave me a valuable tip in your answer for a "problem" I had. So I'm glad I made that mistake ;-)

Comment actions Permalink

So far, followed all suggestions precisely, but no success.

For AIR Android APK, using 3 icons as png's (36, 48 and 72-which are the usual sizes that I have used for Android APK icons in Flash CS6). Added these to a folder: images in the project.

Changed the XML following the above suggestions for setting path: images\icon36.png, etc... (maybe relative path is icon36.png? no images\ ?)

Verified that these changes are reflected in the XML file. (They are, after compiling.)

Went to the project's Android dialog and added these 3 icon png files to the package in the Android tab.

Compile/Build, and the icons are not being used.

Not sure how to fix?

Comment actions Permalink
Compile/Build, and the icons are not being used.

How do you check that icons are not being used? You need to install the app on the device, don't you? So either you create APK using Build | Package AIR Application and install the app maunally, or you start Flash app run configuration (Run | Edit Confgiurations...), that creates package and installs it on the device (and runs the app, so you need to exit it to check the icon).

Changed the XML following the above suggestions for setting path: images\icon36.png

I don't know if it matters in this case but in general forward slashes are preferred. Path can start with images/ or be just icon36.png, just make sure that it matches 'relative path' in the table at Android tab.

Comment actions Permalink

Thank you for these suggestions.

I had been manually installing on an Android device to test. The APK continued to display the default Android icon, not the new custom ones.

I had realized that \ was probably needing to be changed to /, but this did not result in success getting the icon to display.

I tried leaving off the images/, even placed my set of cutom icons directly in the app's root, made sure that the path in the XML matched the relative path in the dialog. So far, cannot get it to work.

I wonder if the latest Apache Flex 4.10 with AIR 3.8 could have a bug? (has anyone else tested using 4.10 and 3.8?)

I will keep trying, testing on the device more.

Comment actions Permalink

4.10 and 3.8 work perfectly fine for me!

Did you include your images/ folder in the list top be packaged? This has to be configured in the page 'files and folders to package' in the window "Android" in the "Module settings" of your project. I had missed that myself ;-)

Is the folder copied to the out/production/myProject/ folder?
Is it included in the .apk package? You can test that in opening the apk file with e.g. 7Zip or Winzip. It should be located in the asstets/ folder.

AIR app assets.jpg
Comment actions Permalink

Thank you for your continued help. I must be doing something wrong. The icons are in the asset folder when I unzip the APK with 7Z. So they are getting there, but not displaying when I test by manually installing the APK on an Android device.

Maybe my paths in the XML are not correct? (It may help to see the screenshot of your XML and project folder tree.)

I am placing the icons (all of them for either APK or Windows AIR: 16, 32, 36, 48, 72 and 128) in a project folder "icons." But, in the Android dialog, I am not sure if I should only add and reference the one  "icons" folder or add/reference all 6 icon png files? Same problem with the XML: do I reference all 6 files in the correct locations?

Maybe a coupe of jpeg's of your working set-up will help. I think my problem is not correctly referencing and matching between the XML, Android dialog/relative path and project tree location for the icons.

Again, thank you very much for your help.

Comment actions Permalink

Looks like you are pretty close!
I atttached a screenshot of the content of the apk file (shown level is assets/images/ with 7zip)
The second screenshot shows the project structure with the images folder as subfolder of src/; together with the <icon> definition in the respective application descriptor XML file.

For my project I included the images/ folder in the list of "to be packaged files and folders". But you can select just the files you need and it will work also.
The packaging process will tell you if a file that is defined in the application descriptor is missing. It also will throw an error if the file cannot be found.
So if you do not see any error messages and find your files in the final apk file with z7ip, that process should work correctly.

Try uninstalling your application on the Android device and deploy again.
Instead of building and copying the app you also can set the run configuration to run it directly on your device. Then the app will be uploaded also and immediately opened.
As Alexander said: close your app so you can see the icon.

Double check if you did not install your app more than once on different screens; that's why I suggested to uninstall first to detect such mistakes.

If that doesn't help, I'm out of ideas for the moment ;-)

AIR app structure.jpg
AIR app apk.jpg
Comment actions Permalink

Success! Thank you very much.

After viewing your XML jpeg, I realized that I was not correctly commenting in/out what was necessary. Once I fixed this syntax, everything worked OK. (I have very little experience working with XML files/syntax.)

Again, thank you.

Comment actions Permalink

Glad I could help!
I'm a beginner also and  happy I could return some of the help I was getting ;-)


Please sign in to leave a comment.