All Products
Document Center

FAQ of accessing Android

Last Updated: Apr 20, 2021

Check the following FAQ list, then click the specific questions to view the answer.

No network connection when you compile

When you are compiling files, if there is no network, the compilation may fail. Follow the steps to confirm that the network of compilation environment is connected.

  1. Confirm that the Internet is connected.
  2. Confirm that the network proxy is not connected, including browser proxy settings and third-party network proxies.
  3. Confirm that the IDE proxy is not configured.
    idea proxy
  4. In the file, confirm that the Gradle proxy is not configured. That is, the systemProp.http.proxyHost and the systemProp.http.proxyPort attribute is not configured. If configured, you can delete the relevant attribute.
    gradle proxy

Program compilation failed

If program compilation failed, you can make troubleshooting and solutions by following the steps.

  1. According to the preceding steps, you can confirm that the network of compilation environment is connected.
  2. Check the Gradle execution log to confirm if the added dependency is valid.
  3. Check if the dependent GAV parameters including group, artifact, and version are configured correctly.
    1. //Reference the debug pack group:artifact:version:raw@jar
    2. bundle ""
    3. //Reference the release pack group:artifact:version@jar
    4. bundle ""
    5. manifest ""
  4. In the command line tool built in the system, execute the following command to export the Gradle execute logs:
    1. // Before executing the command, confirm the undefined productflavor attribute. Otherwise, the command will fail to run.
    2. // The following command will export the execution log to the log.txt file.
    3. gradle buildDebug --info --debug -Plog=true > log.txt
  5. Check the log file exported from the fourth step. In the latest log, you will see the following record, which means the added dependency does not exist.
    1. Caused by: org.gradle.internal.resolve.ArtifactNotFoundException: Could not find nebulacore-build-AndroidManifest.xml (
    2. Searched in the following locations:
    4. at org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult.notFound(
    5. at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveArtifactFromCache(

  6. Visit the http link in this log and log on to check the Maven library. For example, the http link can be the third line in the log listed in the preceding step.

    Note: In the build.gradle file, you can check the account name and password that you need to provide when you log on.

  7. Execute the following command to refresh the gradle cache.
    1. gradle clean --refresh-dependencies
  8. If the Maven library has a relevant dependency, delete the Gradle cache under your personal directory, then recompile.

    Note: See the following method of deleting the Gradle cache.

    • In the system such as MacOS, Linux, and Unix, run the following commands:
      1. cd ~
      2. cd .gradle
      3. cd caches
      4. rm -rf modules-2
    • In the Windows system, by default, the path will be located to C:\Users\\{Username}\\.gradle\caches. Delete the modules-2 folder.

Access problem during compilation

If there is an access problem during compilation, (you have waited for more than 20 minutes) you can improve the compilation efficiency by following the steps.

  1. According to the preceding steps, you can confirm that the network of compilation environment is connected.
  2. Confirm that the firewall is closed.
  3. Confirm that the network configuration of the IntelliJ IDEA encoder is inactivated.
  4. In the code, load Maven images in advance. See the following code example of Maven images loaded by Alibaba Cloud.
  1. apply plugin: 'maven'
  2. buildscript {
  3. repositories {
  4. mavenLocal()
  5. // Load Maven images at first
  6. maven{ url ''}
  7. maven {
  8. credentials {
  9. username "Use the known user"
  10. password "Use the known password"
  11. }
  12. url ""
  13. }
  14. }
  15. dependencies {
  16. classpath ''
  17. classpath ''
  18. classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
  19. }
  20. }
  21. allprojects {
  22. repositories {
  23. flatDir {
  24. dirs 'libs'
  25. }
  26. mavenLocal()
  27. maven {
  28. credentials {
  29. username "xxxxxxxxx"
  30. password "xxxxxxx"
  31. }
  32. url ""
  33. }
  34. maven{ url ''}
  35. }
  36. }

When you access to Apsara Stack, after downloading configurations and accessing to mPaaS, compilation is rejected and NullPointerException occurs

Null pointer exceptionIn general, this is the problem of the configuration file, namely, the conf file. You need to check the fields. Check if any of the thirteen fields are missing. Compare with the files downloaded from the public cloud, and confirm if the field name is correct.

How to debug applications

During the development, you need to debug codes. This topic describes two debug methods.

  • Start the application through the debug mode
  • Run the application, then start debugging

Start the application through the debug mode

  • Use cases:

    The initial code that you want to use when the debug application launched. For example, initialize the code during application init.

  • Procedures:

  1. Execute the command adb shell am start -W -S -D application pack name/The type name of the first page launched by the application. For example, the pack name of the mPaaS Demo is com.mpaas.demo, and the type name of the first page launched by the application is You can use the command line adb shell am start -W -S -D com.mpaas.demo/ to launch the application through the debug mode. See the following picture for the first type name launched. img
  2. After the command is executed, the following dialogue box will appear on the mobile phone.

  3. Set the breakpoint to the code line you want to debug. Then attach the breakpoint to the process where the application is. See the following picture.

    img img

Run the application, then start debugging

  • Use cases:

    Start debugging after you trigger an event. For example, only when you click a button or redirect to a page, you need to debug.

  • Procedures:

    After running the application, click the attached Process button. Or after executing the preceding command, click the attached button, then start debugging.

Precautions for using MultiDex in the mPaaS Inside project

1.When you access to the mPaaS Inside, we have provided MultiDex. Thus, you can delete the MultiDex provided officially from the implementation.

  1. dependencies{
  2. implementation '' //Delete this line
  3. }

Meanwhile, you are suggested to add multiDexEnabled true under the android module of the gradle.

  1. android {
  2. defaultConfig {
  3. multiDexEnabled true
  4. }
  5. }

2.If you are using the mPaaS Inside, and not accessing to the hotfix, while MultiDex is needed to support, you have to call MultiDex.install(this) in the Application.

  1. public class App extends Application() {
  2. public void attachBaseContext(Context context) {
  3. super.attachBaseContext(context);
  4. MultiDex.install(this);
  5. }
  6. }

3.If you are using the hotfix, namely, using the QuinoxlessApplication, you do not need to perform explicit call in the code.

MultiDex is a solution to the problem that the number of Dex methods or types for the earlier versions of Android 5.0 exceeds 65535.

In the case of the bloating appliation features at the moment, we need to plan for the Dex.

Because the mPaaS access method is based on the bundle, the bundle will try to combine once with the user’s Dex when the bundle packages. However, mPaaS will ensure the first Dex sequence of the user.

In this case, in order to access to mPaaS, avoid adding excessive logic in the Application and make the first dex as small as possible. You can use the --main-dex-list parameter to specify your type in the first Dex.

For example, if the first Dex types are excessive in your APK, some necessary bundles in mPaaS will fail to combine. As a result, the framework may fail to start in the running environment earlier than Android 5.0. That is, the problems of ClassNotFound or ClassNotDef.

Precautions for using MultiDex in the mPaaS Portal and Bundle projects

Portal and Bundle are not suggested to intervene in the MultiDex. Unless you are in the single portal project, and need to use the multiDexEnabled true.If your Bundle is too big, you can only continue by the method of splitting the bundle. Do not activate the multidex support in the bundle.

How to clear the Gradle cache

Open the configuration page of the Gradle plug-in, then click Clean Cache button to delete all the cache data of the Gradle plug-in.

Plug-in configuration interface

Upgrade to the latest Gradle plug-in

Note: The content of this section is only applicable for 10.1.68 baselines. For more information about the baseline of this version, see Introduction to the baseline and Launch instructions of 10.1.68 baselines.

The version of the Android Gradle Plugin provided by Google is 3.5.x at the moment.mPaaS also provides the plug-in of 3.5.x version as the adapter, which supports the APIs of Google Android Gradle Plugin 3.5.3 and Gradle 6.3.### Change in the access methods1.You only need to import our plug-ins by adding the following dependency instead of importing the official plug-in of Android Gradle Plugin. Because of the dependency transmission, the plug-in will be imported automatically.dependencies { classpath '' }2.The version of Gradle Wrapper needs to be upgraded to 5.6 or later versions. Version 6.3 is recommended to use.### Change in the usages1. No need to use the apply plugin:''. If you are in the portal project, you only need to use the apply plugin:''.2. If you are in the bundle project, you need to delete the apply plugin:'' and only need to use the apply plugin:''.3. For the library project, you still need to use the apply plugin:''.4. If using the latest stable version of Android Studio 3.5 or later versions, you need to add android.buildOnlyTargetAbi=false in the Our wireless security components do not support V2 signatures at the moment. Thus, if you need to use Android Studio debugging and install your APK, you need to disable V2 signatures. If you use the command line for creation, and your minSdkVersion is greater than or equal to 24, you need to disable V2 signatures as well. See the following method of disabling V2 signatures:v2SigningEnabled false
After clearing the cache, you need to check if the mini program and H5 work.

Camera cannot be turned on through the input file label in Huawei 10 System

There are some differences between the implementations of Huawei 10 system URI and the standard Android. Thus, you may meet problems such as failing to turn on the camera in Huawei 10. You need to execute the following steps to solve this problem.

1. Upgrade baselines

  • If you are using 32 baselines, you need to upgrade the baseline to or later.
  • If you are using 60 baselines, you need to upgrade the baseline to or later.
  • If you are using 68 baselines, you need to upgrade the baseline to 10.1.68-beta.3 or later.

2. Configure FileProvider

You can reuse your current FileProvider or create a new FileProvider.

  1. Create a new Java class to inherit the FileProvider.
    1. import;
    2. public class NebulaDemoFileProvider extends FileProvider {
    3. }
  2. Create a new nebula_fileprovider_path.xml in res/xml.
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <paths xmlns:android="">
    3. <external-path name="external" path="."/>
    4. </paths>
  3. Add configurations in AndroidManifest.
    1. <provider
    2. android:name="com.mpaas.demo.nebula.NebulaDemoFileProvider"
    3. android:authorities="com.mpaas.demo.nebula.provider"
    4. android:exported="false"
    5. android:grantUriPermissions="true">
    6. <meta-data
    7. android:name=""
    8. android:resource="@xml/nebula_fileprovider_path" />
    9. </provider>
Note: Here the value of android:authorities, namely com.mpaas.demo.nebula.provider is an mPaaS sample code. You need to configure by yourself based on your applications. And the value cannot be configured as com.mpaas.demo.nebula.provider, which will have conflicts with other mPaaS applications.

3. Implement the H5NebulaFileProvider

  1. Create a new Java class, then implement the H5NebulaFileProvider and the getUriForFile method. In this method, you can call the implemented FileProvider to generate URI.

    1. public class H5NebulaFileProviderImpl implements H5NebulaFileProvider {
    2. private static final String TAG = "H5FileProviderImpl";
    3. @Override
    4. public Uri getUriForFile(File file) {
    5. try {
    6. return getUriForFileImpl(file);
    7. } catch (Exception e) {
    8. H5Log.e(TAG, e);
    9. }
    10. return null;
    11. }
    12. private static Uri getUriForFileImpl(File file) {
    13. Uri fileUri = null;
    14. if (Build.VERSION.SDK_INT >= 24) {
    15. fileUri = NebulaDemoFileProvider.getUriForFile(LauncherApplicationAgent.getInstance().getApplicationContext(), "com.mpaas.demo.nebula.provider", file);
    16. } else {
    17. fileUri = Uri.fromFile(file);
    18. }
    19. return fileUri;
    20. }
    21. }
  2. Register the H5NebulaFileProvider.
    After you complete the mPaaS initialization, register the H5NebulaFileProvider before you start the off-line pack. Register once will take effect globally.

    1. H5Utils.setProvider(H5NebulaFileProvider.class.getName(), new H5NebulaFileProviderImpl());

How to depend on and use mPaaS in library?

While using mPaaS, a module needs to be reused sometimes. The reuse is implemented by adding the module as a dependency. This section illustrates this method with an example of reusing scan module.


The project has been accessed to mPaaS in native AAR mode.


  1. Create an Android Library type scan module in the project.

  2. In the build.gradle file of the newly created scan module, add the following codes api platform("$mpaas_artifact:$mpaas_baseline"). The example is as follows:

    1. dependencies {
    2. ……
    3. //This line is necessary when using mPaaS in the module.
    4. api platform("$mpaas_artifact:$mpaas_baseline")
    5. ……
    6. }
  3. Install scan component for scan module by Android Studio mPaaS plug-in. The directory is : mPaaS > Native AAR mode > Configure/Update component > Start configuration. After the installation, the scan component will automatically load.

  4. Configure App main project.

    1. plugins {
    2. id ''
    3. ......
    4. // baseline.config (baseline) must be added in the build.gradle file of app module.
    5. id ''
    6. }
  5. Call module.
    Import scan module where it is used.

    1. dependencies {
    2. api platform("$mpaas_artifact:$mpaas_baseline")
    3. ....
    4. api project(':scan')//scan module
    5. }