Install Mobile Explorer Agent for Android (Android Studio)
Notes: If you are developing a mobile application that targets Android 6 or later that integrates with Mobile eXplorer Agent, make sure you enable app permissions on Android 6.0+ devices when deploying your application to that Android device.
This section will show you how to integrate qTest Mobile eXplorer Agent to your application on Android devices in Android Studio.
- IntelliJ IDE can open Eclipse project. We don’t support integration for this type and recommend you to using Eclipse IDE instead (Please go back to section 5.1)
- If you want to convert it to Android Studio IDE, please follow instruction in Android Developer Site: https://developer.android.com/sdk/installing/migrate.html
These are the steps that you need to go thru:
- AndroidStudio: 1.0.+
- IntelliJ CE 14.0.+/ IntelliJ Ultimate 14.0.+
- Old versions: please lookup Question 3 in Trouble Shooting.
- AndroidStudio: 1.0.+
- IntelliJ: 0.14.+
- Android SDK
- Android NDK
- Android Build Tool 21.1.2
- Android Support Library 21.0.3
You have to make sure your project work properly before we go to steps below.
Download Mobile EXplorer
In the first step, you need to download the Mobile eXplorer Agent from HERE
Add Mobile Explorer to Project
- Extract “Mobile_eXplorer_Agent_AndroidStudio.zip” archive file, you will get folder with name “Mobile_eXplorer_Agent_AndroidStudio”
- Open your project in Android Studio/IntelliJ
- Copy “Mobile_eXplorer_Agent_AndroidStudio” folder to your project root folder. In Mac you can use Finder, in Windows, you can use Explorer to do that
- Back to Android Studio/IntelliJ, project will auto refresh, if not you have to refresh by click File->Synchonize
- Open Project Panel->Select Project in Combo Box, you can see a folder “Mobile_eXplorer_Agent_AndroidStudio”
- Change “Mobile_eXplorer_Agent_Studio” to Android Library Module.
- Open “setting.gradle” file, this file is in your root project folder
- Append this script to the end of line:
Example: My “setting.gradle” file
- After you change .gradle file, AndroidStudio/IntelliJ will ask you to sync gradle files ' Select Sync Now in top right window.
- After Sync gradle files ' Mobile_eXplorer_Agent_AndroidStudio became a module (bold).
- To avoid effective to your project, we suggest you create new build flavor from active flavor to enable Mobile_eXplorer. If your project has multiple flavors, clone a flavor from active flavor. Otherwise you have to create 2 flavors, one will run without Mobile eXplorer Agent (active flavor) and another one will run with Mobile eXplorer Agent.
- Open your main module “build.gradle” file.
- Create an empty flavor (in case you don’t have any flavor): In android tag add this scripts:
- Clone active flavor and name it to “mobileExplorer”
- Add these scripts to flavor “mobileExplorer”
- Add repository jcenter (if it’s missing)
- Add AspectJ dependency in buildscript tag:
- Add Maven Repository in buildscript tag (if it’s missing)
Example: After change build script, my main module “build.gradle” looks like:
- Sync your project gradle files, you can see in Build Variants Panel, your main module will have multiple build variants, if you select build variant start with “mobileExplorer” when run “app”, “Mobile_eXplorer_Agent” will be enable and be able to run, otherwise it cannot run and do not effect to your app.
- If using IntelliJ IDE, change module “Mobile_eXplorer_Agent_AndroidStudio” build script file.
- Open “build.gradle” file of “Mobile_eXplorer_Agent_AndroidStudio” module.
- Change android build gradle version to the same with your project.
- Provide SDK & NDK local location in global local.properties file. This file is located in project root folder. If it is not exist, please create it.
Example: this file in my test project (in a Mac computer)
Enable Agent on App
- Configure Mobile eXplorer Settings
- Open mexplorer_config.properties. This file is located in Mobile_eXplorer_Agent_AndroidStudio/src/main/assets/mexplorer_config.properties. Change this file like this code:
Example: The configuration below, we using in beta site:
Build and Release App
Now you finish integrating Mobile eXplorer into your testing application, please build and run.