Menu

Troubleshooting - Mobile Explorer Android

 

Enable Permissions

Enable app permission on Android 6.0 and Up

Android 6.0 (and newer) provides a new permission system, which allows user to enable or disable permissions for a specific Android application. This article Control your app permissions on Android 6.0 and up provides information to control which permissions an app can access after the app installs on your device.

In this guide, we use an example application called Native Testbed being built with Android API 23 (Android 6). After being installed on Nexus 5 device, which runs Android 6.0.1, it did not work. The following guideline shows how to fix this issue.

Step 1: Go to Settings -> Apps then select "Native Testbed" application

Step 2: In App info, select Permissions

Step 3: Grant all permissions for the Native Testbed app

Step 4: Go to Settings again and make a search for: “App permissions”, then select that item

Step 5: Select “Draw over other apps” item on next screen

Step 6: Verify that "Native Testbed" app is granted permission

Open "Native Testbed" application and verify that it works as expected

Frequently Asked Questions

Question 1: Gradle Settings

Why can I build and run a project successfully with IntelliJ but why can't see any “setting.gradle” or “build.gradle” file in my root project folder?

  • Answer: 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

Question 2: Top Level Exception

In Android Studio, the project build fails with error UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define. What should I do?

  • Answer: This error happens when your project is being conflicted android-support-v4 library. Follow steps below to fix it
    • Change buildToolsVersion in each module to “21.1.0” or above (in module Mobile_eXplorer, we use buildToolsVersion 21.1.2)
    • If your modules are using android-support-v4 library (in module Mobile_eXplorer_Agent_AndroidStudio, we use android-support-v4 21.0.3), make sure its use the same version.
    • If your modules use android-support-v4.jar in libs folder in each module, we suggest you use dependency in build.gradle instead. To do that, you delete android-support-v4.jar file in libs folder and add a dependency to module build.gradle file.

      Example:

      dependencies {
          compile 'com.android.support:support-v4:21.0.3'
      }
      
    • To avoid conflict android-support-v4 library, add these scripts to build.gradle in root project folder:
      configurations {
          all*.exclude group: 'com.android.support', module: 'support-v4'
      }
      

      Example: My root build.gradle file looks like:

      buildscript {
          repositories {
              jcenter()
          }
          dependencies {
              classpath 'com.android.tools.build:gradle:1.0.0'
              // NOTE: Do not place your application dependencies here; they belong
              // in the individual module build.gradle files
          }
      }
      allprojects {
          repositories {
              jcenter()
          }
      }
      configurations {
          all*.exclude group: 'com.android.support', module: 'support-v4'
      }
      
    • If your module using library android-support-appcompat-v7 and android-support-v4, you should include only android-support-appcompat-v7 because it contain android-support-v4

      Example:

      dependencies {
          compile 'com.android.support:appcompat-v7:+'
         //remove this line 
         compile 'com.android.support:support-v4:21.0.3'
       } 
      

Question 3: Old Versions

My project uses old AndroidStudio/IntelliJ versions, can I use Mobile_eXplorer? How?

  • Answer: We tested on previous versions of Android Studio/IntelliJ. It works on Android Studio beta 0.8.x and IntelliJ 13 (We don't support IntelliJ 12). As you know, the previous version uses old gradle build tools, and some script APIs changed. If your project use gradle build tool version 0.14.0 or above, you can follow the instruction for AndroidStudio/IntelliJ, otherwise, if your Gradle builds tool below 0.14.0, please follow these steps to fix it:
    • Open build.gradle file in Mobile_eXplorer_Agent_AndroidStudio
    • Change gradle build tool version to version that your project use

      Example:

      classpath 'com.android.tools.build:gradle:0.12.2'
    • Open main module build.gradle
    • Replace scripts in "mobileExplorer" productFlavor
                 //enable aspectJ run in your app
                          apply plugin: 'android-aspectj'
      
                          //enable native renderscript
                          renderscriptSupportMode true
                          renderscriptTargetApi 21
      
                          dependencies {
                              //compile module Mobile_eXplorer_Agent_AndroidStudio
                              mobileExplorerCompile project(':Mobile_eXplorer_Agent_AndroidStudio')
                          }
                      
    • If you have error "Build script error, unsupported Gradle DSL method found: 'minifyEnabled()"

      - Open build.gradle file that cause error

      - Replace line "minifyEnabled false" by "runProguard false"

      Example: My build.gradle file looks like

      repositories {
                              jcenter()
                          }
                          buildscript {
                              //add Maven repo
                              repositories {
                                  mavenCentral()
                              }
      
                              //add AspectJ dependency
                              dependencies {
                                  classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.5'
                              }
                          }
      
                          apply plugin: 'com.android.application'
      
                          android {
                              compileSdkVersion 21
                              buildToolsVersion "20.0.0"
      
                              defaultConfig {
                                  applicationId "lelee.cardsaganistandroid"
                                  minSdkVersion 15
                                  targetSdkVersion 21
                                  versionCode 1
                                  versionName "1.0"
                              }
                              buildTypes {
                                  release {
                                      runProguard false
                                      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                                  }
                              }
      
                              productFlavors {
      
                                  //active flavor
                                  activeFlavor {
      
                                  }
      
                                  //build flavor that enable Mobile eXplorer
                                  mobileExplorer {
                                      //enable aspectJ run in your app
                                      apply plugin: 'android-aspectj'
      
                                      //enable native renderscript
                                      renderscriptSupportMode true
                                      renderscriptTargetApi 21
      
                                      dependencies {
                                          //compile module Mobile_eXplorer_Agent_AndroidStudio
                                          mobileExplorerCompile project(':Mobile_eXplorer_Agent_AndroidStudio')
                                      }
                                  }
                              }
                          }
      
                          dependencies {
                              compile fileTree(dir: 'libs', include: ['*.jar'])
                              compile 'com.android.support:appcompat-v7:21.0.3'
                          }
                      

Question 4: No Such Property Error

I encounter an error below when integrating with Android Mobile Explorer

  • No such property: bootClasspath for class: com.android.build.gradle.LibraryPlugin
  • No such property: bootClasspath for class: com.android.build.gradle.AppPlugin

Answer: To fix build error, please add 2 lines of code below to app/build.gradle file just before apply plugin: 'com.android.application'

    com.android.build.gradle.LibraryPlugin.metaClass.getBootClasspath={androidBuilder.getBootClasspath(true) }
    com.android.build.gradle.AppPlugin.metaClass.getBootClasspath={androidBuilder.getBootClasspath(true) }

For more detail, please refer to: http://stackoverflow.com/questions/28434161/android-unit-tests-no-such-property-bootclasspath

Subscribe To Our Blog
Powered by Zendesk