Running AMP For Mobile Tests on a physical device from within Android Studio does not require any additional AMP-specific steps, but there are some steps that must be taken within the device and on your computer.
Testing With A Physical Device In Mac OS
1. Navigate to 'Settings'>'About Phone' and tap the 'Build Number' field 7 times; this will turn on developer mode.
2. Navigate back to the 'Settings' page and select 'Developer Options'.
3. Enable 'USB Debugging'
4. Connect your physical device to your computer via USB
5. Select the 'USB Connection' selector in the phone's dropdown screen (looks similar to this on most phones [see screenshot]):
6. Change to camera (PTP), which might also be listed as 'Transferring images', if a 'USE USB for' dialog window opens.
7. Select 'USB Debugging' if prompted (if not prompted, just make sure you navigate back to 'Developer Options' and select 'USB Debugging' again.
8. Open Android Studio.
9. Open Existing Application Project, such as the SSB Sample App (or create a new one)
10. In Android Studio, select 'Run Android Accessibility Test'
- If a physical device is not already detected, please follow these steps:
- Navigate to a terminal on your Mac
- Type the commands found here: http://www.techotopia.com/index.php/Testing_Android_Studio_Apps_on_a_Physical_Android_Device#Mac_OS_X_ADB_Configuration) in the 'Mac OS X ADB Configuration' section
11. Once the physical device is detected, select 'Run Android Accessibility Test' again
Expected Result: This will load the app onto the physical device, where you can begin testing as you would in an emulator, posting modules by navigating from screen to screen. The screens visited will be added to the active AMP report in the toolbox. For more information about the testing process in AMP for Android Studio, you can visit our documentation on testing found here:
If you run into any issues or if you have any questions, please feel free to reach out to firstname.lastname@example.org with them.
What Could Go Wrong
When carrying out 'android update adb' (Step 12c.), if you encounter an 'android command not found' error, follow these steps:
android: command not found error
follow two easy steps (Linux and Mac):
1) Export your Android Sdk path to the ANDROID_HOME variable
$ export ANDROID_HOME=~/Android/Sdk
(change "~" to "$HOME" on Mac)
2) Export Sdk tools path to the PATH variable
$ export PATH=$ANDROID_HOME/tools:$PATH
That's it! run
command again to make sure it works properly.