-
-
Notifications
You must be signed in to change notification settings - Fork 41
Debug an Adobe AIR application running on a mobile device with Visual Studio Code
-
Create a new ActionScript project targeting Adobe AIR for mobile.
-
In Visual Studio Code, open the View menu and select Debug. Alternatively, click the debug icon on the sidebar, or use the Ctrl+Shift+D keyboard shortcut (or Command+Shift+D on macOS).
-
Click the gear ⚙︎ icon to configure the launch configurations for your workspace.
-
When prompted to Select Environment, choose SWF.
If .vscode/launch.json already exists in your workspace, you will not be asked to specify the environment. Instead, the existing file will open. You may click the Add Configuration button to add a new SWF debugging configuration to the existing file. Several default snippets are available, depending on which Adobe Flash runtime you are targeting.
-
A new editor will open with a launch.json file that looks something like this:
{ // Use IntelliSense to learn about possible SWF debug attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "swf", "request": "launch", "name": "Launch SWF" }, { "type": "swf", "request": "attach", "name": "Attach SWF" } ] }
-
To debug on a mobile device, we'll need to add a couple of new launch configurations to this file.
{ "type": "swf", "request": "attach", "name": "Install and Attach (iOS)", "platform": "ios" }
{ "type": "swf", "request": "attach", "name": "Install and Attach (Android)", "platform": "android" }
-
Package the Adobe AIR application. It must be a debug build for either iOS or Android.
-
Ensure that one of the new Install and Attach configurations is selected is the Debug sidebar, and press the button with the play
▶️ icon to start debugging. Alternatively, use the F5 keyboard shortcut to start debugging. -
When your app is finished installing, it will launch automatically on Android. On iOS, you will need to manually launch your application before the debugger will connect.
By default, debugging an Adobe AIR application on a mobile device will connect over wifi. To debug over USB instead, see listen
in asconfig.json and connect
in launch.json for details.
Additionally, you will need to run one of the following commands:
For Android devices, run the following adb command:
adb forward tcp:7936 tcp:7936
adb is located in /lib/android/bin.
For iOS devices, run the following idb command:
idb -forward 7936 7936 1
idb is located in /lib/aot/bin/iOSBin.
Instead of packaging your AIR app manually before debugging, you can configure launch.json to run a task automatically when you start the debugger.
If you set the preLaunchTask
field in launch.json to the same value as the identifier
field of one of the tasks defined in tasks.json, it will automatically run that task before installing the app and debugging.
In the following tasks.json, we have some tasks to package a debug build for iOS or Android, and each one has an identifier:
{
"version": "2.0.0",
"tasks": [
{
"identifier": "build-debug-ios",
"type": "actionscript",
"air": "ios",
"debug": true
},
{
"identifier": "build-debug-android",
"type": "actionscript",
"air": "android",
"debug": true
}
]
}
Specify that identifier as the preLaunchTask
in launch.json to run that task automatically when launching in the debugger:
{
"version": "0.2.0",
"configurations": [
{
"type": "swf",
"request": "attach",
"name": "Install and Attach (iOS)",
"platform": "ios",
"preLaunchTask": "build-debug-ios"
},
{
"type": "swf",
"request": "attach",
"name": "Install and Attach (Android)",
"platform": "android",
"preLaunchTask": "build-debug-android"
}
]
}
- Adobe AIR (Mobile)
- Adobe AIR (Desktop)
- Adobe Flash Player
- Apache Royale
- HTML and JS (no framework)
- Node.js
- Feathers SDK
- Adobe Animate
- Classic Flex SDK
- Library (SWC)
- Royale Library (SWC)