Page updated Nov 13, 2023

Debugging

When running a debug build of your app, you can access information, view logs, and file GitHub issues for Amplify directly from your application through the developer menu. By filing GitHub issues through the developer menu, critical information about the issue (device and environment information) is automatically added to the issue description, allowing Amplify team members to better assist you in resolving the issue.

Amplify Android Developer Menu

The developer menu is disabled in production app builds.

Setup

To enable the developer menu, pass a custom configuration when configuring Amplify:

1AmplifyConfiguration config = AmplifyConfiguration.builder(getApplicationContext())
2 .devMenuEnabled(true)
3 .build();
4Amplify.configure(config, getApplicationContext());
1val config = AmplifyConfiguration.builder(applicationContext)
2 .devMenuEnabled(true)
3 .build()
4Amplify.configure(config, applicationContext)

Next, run the following commands from the Android project directory to add a copy of the file ./amplify/.config/local-env-info.json to the ./app/src/main/res/raw/ directory in your Android project and rename the copy to localenvinfo.json:

1cp amplify/.config/local-env-info.json app/src/main/res/raw
2mv app/src/main/res/raw/local-env-info.json app/src/main/res/raw/localenvinfo.json

If the amplify directory is not in your Android project folder, please follow the project setup instructions. The file local-env-info.json contains environment information that will be displayed on the developer menu.

Access and Usage

Shake the device to access the developer menu during a debug build of your app. An emulator can be shaken by selecting the more option (denoted by three dots) next to the emulator, navigating to the “Virtual Sensors” tab, clicking the “Move” button, and then moving the emulator shown within the “Virtual Sensors” tab back and forth a few times.

Shows how to simulate shaking the Android Emulator as mentioned above

The developer menu contains the following:

  • Environment Information - View versions of Amplify plugins used in your app and developer environment information.
  • Device Information - View information about the device you are using to run your application.
  • Logs - View and search the logs generated by Amplify loggers.
  • File a GitHub Issue - After providing a description of your issue, an issue report is generated. The issue report contains your issue description, environment information, and device information. Within the developer menu, you can copy this issue report or directly file an issue on GitHub. The issue body will be pre-populated with the aforementioned information. When using the developer menu to file a GitHub issue, you will have an opportunity to review the issue information before filing the issue.