-
Notifications
You must be signed in to change notification settings - Fork 8
Debugging AIM
- Right-mouse click on the page and select Inspect Element. You should see the screen split, with several panes on the bottom. These will allow you to view the content and stylings of each element on the page, as well as step through the javascript source.
- Click on the Sources tab to view the various sources associated with adapt-it-mobile. You might need to click Cmd+O to open one of the files.
- Click on a line number in the source (javascript) to set a breakpoint. The toolbar in the right-hand pane gives you the standard debugging actions, and the right-hand pane itself will show the call stack, let you set watch expressions, look at variable values, etc.
- If you haven't already, open up Safari > Preferences > Advanced and check "Show Develop menu in menu bar". Close out the preferences and reload the index.html page.
- Right-mouse click on the content and select Inspect Element. Unlike Firefox or Chrome, Safari's inspector is a separate window that's similar to Xcode in its layout. Files are on the left column, selected file in the middle, inspector on the right. Click on the Debugger in the toolbar to set breakpoints, etc.
I've just done some cursory debugging to track down a pesky path error so far. Console log messages are viewable through Android's logcat utility, but need to be filtered out by the application using it. Here's the command to view all the console.log commands that cordova apps produce (debug or higher):
adb logcat CordovaLog:D *:S
The steps here are similar to running in the browser. Once you type either cordova emulate ios
or run AIM through XCode, you'll be using Safari's inspector:
- If you haven't already, open up Safari > Preferences > Advanced and check "Show Develop menu in menu bar". Close out the preferences and start the iOS emulator (either from Xcode or the command line).
- Once AIM launches in the iOS emulator, go back to Safari and select Develop > iOS Simulator > index.html. You should see Safari's inspector window display.
The folks at PhoneGap have created a developer app that serves your application. This kind of works, except that some of the plugins don't work the same way they do on the device. Caveat tester I suppose.
- Head over to http://app.phonegap.com/ and follow the instructions to install the application on your computer.
- Launch the PhoneGap Developer application and drag AIM's source folder (e.g.,
~/dev/adapt-it-mobile
) to the PhoneGap Developer application window. - At the bottom of the PhoneGap Developer app, make a note of the IP address it's serving AIM on.
- On your Android or iOS device, install the PhoneGap app from either the Google Play store or the iTunes store.
- Launch the PhoneGap app on your Android or iOS device. The little robot guy should prompt you for an IP address to connect to. Enter the IP address from step 3 and click Connect.
Again, not everything work exactly like it does on the device. But this is a quick way to see changes you're making in the app.
the logcat
command also works for devices running in developer mode that are connected via USB to your computer. Under your Android Settings > System > Developer options, select USB debugging. Note that on newer devices, the Developer options menu is hidden by default. To display it, you'll need to go to Setings > About tablet (or phone) and click on Build number 7 times. Seriously.
Once you've done this, you can connect a USB cable and start AIM. There are a couple commands that I've found:
-
adb logcat CordovaLog:D *:S
This displays the CordovaLog messages. (If you are using an older version of AIM that uses the crosswalk browser, the command would filter for the Chromium browser like this:adb logcat chromium:D *:S
). -
adb shell logcat > log.txt
This pipes the console log messages to the file log.txt in the current directory. This does seem to work, but gives you a lot of extra log messages besides those coming from AIM.
Remote Debugging
Android also has the option of remote debugging apps through Chrome (and a USB cable attached to the device):
https://developers.google.com/web/tools/chrome-devtools/remote-debugging/
This is as far as I've needed to go; if I need to debug down in iOS I'll add that info here.
Home | About | Using Adapt It Mobile | Contributing | Copyright © 2014-2024 Adapt It
- Localizing the Adapt It Mobile User Interface
- Creating Graphics for Adapt It Mobile
- Reporting a problem / bug
- Developing Adapt It Mobile on Linux
- Developing Adapt It Mobile on OS X
- Developing Adapt It Mobile on Windows
- Getting Started with the code
- Compiling locally
- Running in an emulator
- Debugging
- Tips and Tricks
- Development Troubleshooting