Does your AEM App get stuck at a blank screen when you run it via the Cordova CLI?
The following steps will help you get to the root of the error on both iOS and Android.
iOS
These steps assume you have a functional Cordova build toolchain (including Xcode and the iOS Simulator), and are able to run cordova platform add ios && cordova emulate ios
without any CLI related errors.
Enable Develop menu in Safari
From Safariās menu, open āPreferencesā¦ā, and navigate to the āAdvancedā tab.
Make sure the checkbox labeled āShow develop menu in menu barā is checked:
Connect the web inspector to your broken app
From the freshly enabled Develop menu, initiate a connection to your app running on the iOS Simulator (Iāll be using the kitchen-sink app for this post):
You will be greeted by a new Web Inspector Safari window that is connected to the AEM App running on your iOS Simulator.
Refresh to see initialization errors
Navigate to the Console tab. You shouldnāt see any errors, aside from perhaps Safari attempting to load source maps that have not been provided. In order to see any errors which occurred during the initialization of the app, you will need to refresh the app. Locate the āReload pageā button and give it a click (or: hit ā + R on your keyboard):
You should now see a few lines of debug logging, along with an error!
In my case it appears that the ContentSync variable is missing. This variable is exported by the PhoneGap ContentSync plugin, so I would begin my bug investigation by seeing if this plugin has been successfully installed.
If this issue is occurring on an app obtained from an open source repo, the console output is extremely valuable and should be included in your bug report.
Android
Like above, ensure that you are able to run cordova platform add android && cordova emulate android
without any CLI related errors before continuing.
Connect Chromeās web inspector to the app
In Chrome, navigate to chrome://inspect, and locate your appās WebView. Click the blue āinspectā link to open the remote web inspector connected to your Android emulator.
Refresh to view initialization errors
Open the console tab and hit ā + R on OS X, or Ctrl + R on Windows to refresh the current page of the application. In the screenshot below, I donāt have any errors in the console but I can still view the output of console.log statements in my code, such as navigation between pages:
Happy debugging!