[Tutorial] Create EXE for HF and APK for HFX using Adobe AIR SDK by HARMAN - Printable Version +- Hero Fighter Empire - Forums (https://hf-empire.com/forum) +-- Forum: Hero Fighter Zone (https://hf-empire.com/forum/forumdisplay.php?fid=10) +--- Forum: Data Changing (https://hf-empire.com/forum/forumdisplay.php?fid=35) +---- Forum: Tutorials (https://hf-empire.com/forum/forumdisplay.php?fid=36) +---- Thread: [Tutorial] Create EXE for HF and APK for HFX using Adobe AIR SDK by HARMAN (/showthread.php?tid=386) |
Create EXE for HF and APK for HFX using Adobe AIR SDK by HARMAN - MangaD - 02-06-2021 Although Adobe has abandoned Flash in 2020, it has transitioned the ongoing support and development of Adobe AIR to HARMAN, a Samsung company. You can read more on this here. This means that we can still create executable versions of HF and HFX using the latest Flash Player version for the latest platforms (e.g. Android 10+). The instructions for creating packages of HF and HFX differ, with HFX being the most complicated one. I will start with HF (PC version). For these instructions, you will need to download and extract AIR SDK by HARMAN. Note that in the end there will be a splash screen of this company when opening the game. It cannot be removed without payment as you can see here. Do not attempt to remove it through hacking, it is illegal. PC version: 1. Go to AIRSDK_Windows\bin folder, create a folder for your app there (e.g. CoronationWars). Open the folder that you have just created.2. Inside this folder, create a file called application.xml with the following content:
Notice that we are using version 50.2 of Flash Player (currently the latest and released by HARMAN). We have decided to give the version 1.1 to this package of Coronation Wars mod. In this case we are creating a package for the 64-bit architecture, thus using the 64-bit version of the Flash Player. The reason for this is that Coronation Wars crashes on the 32-bit FP due to having large resource files inside. 3. Place the game's SWF file in this folder (with the same name as the one in the content tag in the application.xml file). Create a icons folder and place your icon images there accordingly to the information in the application.xml file. The directory structure should look like this:
4. Open PowerShell inside the CoronationWars folder. (You can do this using the context menu. Shift+right click on the empty space inside the folder for that option to appear).5. Optionally, you can test the app right away with the following terminal command:
6. Create a certificate to sign your app (this may help with some anti-viruses not giving false positives). Run the following command for this:
Instructions taken from here. You'll be prompted for the password you chose when packaging in the next phase. 7. Now you can either create a bundle (a folder containing various necessary files and an EXE that you can run the game with) or an installer. Bundler:
Installer:
The password I used here is "SomePasswordOfYourChoice". You can change it in the previous step. Note: Type the password when prompted and hit enter, regardless of whether the characters you type show up or not. HFX (Android): You will need the original (or modded) APK for this. You can download it from here. 1. Open the APK file with an archive manager (APK is a ZIP file). 2. Extract the classes.dex file inside the APK and convert it to a JAR file using the dex2jar tool.3. Open the JAR file (which is also a ZIP file) with an archive manager and extract the files inside (they are the compiled Java classes from the AIR Native Extensions that HFX uses) to some folder of your choice, we will be using them soon. 4. Inside the bin directory of Adobe AIR by HARMAN, create a directory for each extension:
5. The unpacked extensions can be found inside the APK, in the path /assets/META-INF/AIR/extensions/ . For each extension, add catalog.xml and library.swf into a ZIP file, and renamed the ZIP extension to SWC (e.g.: com.adobe.ane.social.swc ). Then, place the SWC file inside the respective extension's directory.6. Inside each extension's directory in the APK, there is a path META-INF/ANE/ where the file extension.xml and other files can be found (e.g.: /assets/META-INF/AIR/extensions/com.adobe.ane.social/META-INF/ANE/ ). Place all the files inside these directories in the directories of the respective extensions that you created in the bin directory. For the com.chartboost.plugin.air extension, for example, this is what the directory structure looks like:
If you open the extension.xml file you can see that these are its contents (in the original APK):
As we are not packaging the game for iPhone-ARM nor do we have the libChartboostAir.a file, you must comment that platform block using XML comments <!-- --> , or simply remove that block altogether.We can see that there is a default platform (I noticed that all extensions have one). So, create a directory for the default platform and copy library.swf from the Android-ARM directory to it. Then place both directories inside a platform directory. The directory structure now looks like this:
Then, from the JAR file that we got at the beginning (converted from classes.dex ), get all the classes related to com.chartboost.plugin.air and place them in a ZIP archive named libChartboostAir.jar . Then place libChartboostAir.jar inside the Android-ARM directory.Open PowerShell inside the extension's folder. (You can do this using the context menu. Shift+right click on the empty space inside the folder for that option to appear). Finally, for this extension, run the following command to generate the ANE file:
Do the same for the other extensions following the above steps. At the end, there can be some classes in the JAR file (generated from classes.dex ) that you haven't placed in the JAR file from any extension, because you may not know to which extension they belong. So, just placed them in a random extension's JAR file. This isn't a problem because what matters is that all classes end up being placed in the new classes.dex file, using the same directory structure as the original.7. Once all ANE files are compiled, create a HeroFighterX directory in the bin directory.8. Inside the original APK's assets directory, there are the app's SWF file and a _Pic_Gen directory with the app's icons. Place them both in the HeroFighterX directory. And in the original APK's /assets/META-INF/AIR/ directory there are an application.xml file and an extensions directory (with the unpacked ANEs). Placed the application.xml file inside the HeroFighterX directory. Inside this directory, create an extensions directory and place the compiled ANE files inside. So, the directory structure for this app now looks like this:
9. Change the targetSdkVersion in the manifest inside application.xml to 33, in order to support Android 13 (currently the latest). Android version and SDK correlation: https://developer.android.com/studio/releases/platforms10. Change <application xmlns="http://ns.adobe.com/air/application/17.0"> to <application xmlns="http://ns.adobe.com/air/application/50.2"> , so that it uses the latest Flash Player version (50.2 is from HARMAN).11. With the latest Adobe AIR, the following line should be added to the application.xml file under the <android> section if one does not wish to use the Android SDK for building.
Another option is to use the Android SDK for building, in which case the following lines should be added in the file AIRSDK_Windows\lib\adt.cfg (replace with correct paths):
Note that Java 11 or above must be used. 12. Android 12 and higher require receivers with intent filters to have the attribute android:exported. Example:
or else, the following error will show up: Quote:Error: Apps targeting Android 12 and higher are required to specify an explicit value for
13. To allow screen recorders to capture the game's audio in Android 10 and above, it is necessary to add the following attribute in the Android app manifest file. It is located in the application.xml file under the <android> section.
Source: https://developer.android.com/guide/topics/media/av-capture 14. Create a self-signed certificate:
Instructions taken from here. 15. In the lib folder from AIR SDK from HARMAN there is a file called adt.cfg . Add the following line to it:
This fixes the error: Quote:There was a problem parsing this package.when trying to install the app on some devices. The error that I was getting when profiling the APK with Android Studio was: INSTALL_PARSE_FAILED_RESOURCES_ARSC_COMPRESSED Then I came across this issue in AIR SDK from HARMAN. Opening lib/adt.cfg showed me the commented line and I simply uncommented it and added the arsc extension to it, which is the extension of the file resources.arsc that Android Studio was complaining about.16. Finally you can package the new APK using the following command in PowerShell:
If using Linux, you can run instead:
which will require adding AndroidPlatformSDK=/home/<user>/Android/Sdk/ to the lib/adt.cfg file.This step is no longer necessary with the latest Adobe AIR (Click to View) PS: If this tutorial was useful to you, please vote up my question and answer in this StackOverflow page. |