All Products
Search
Document Center

Mobile Platform as a Service:FAQ of accessing Android

Last Updated:Jun 16, 2026

Click a question to view the answer.

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

Huawei 10 system handles URIs differently from standard Android, which may cause issues such as failing to turn on the camera. Perform the following steps to resolve this issue.

1. Upgrade baselines

  • If you are using 32 baselines, you need to upgrade the baseline to 10.1.32.18 or later.

  • If you are using 60 baselines, you need to upgrade the baseline to 10.1.60.9 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.

    import android.support.v4.content.FileProvider;
    public class NebulaDemoFileProvider extends FileProvider {
    }
  2. Create a new nebula_fileprovider_path.xml in res/xml.

    <?xml version="1.0" encoding="utf-8"?>
    <paths xmlns:android="http://schemas.android.com/apk/res/android">
     <external-path name="external" path="."/>
    </paths>
  3. Add configurations in AndroidManifest.

    <provider
     android:name="com.mpaas.demo.nebula.NebulaDemoFileProvider"
     android:authorities="com.mpaas.demo.nebula.provider"
     android:exported="false"
     android:grantUriPermissions="true">
     <meta-data
         android:name="android.support.FILE_PROVIDER_PATHS"
         android:resource="@xml/nebula_fileprovider_path" />
    </provider>
Note

The com.mpaas.demo.nebula.provider value for android:authorities is a sample. Replace it with a value specific to your application. Do not use com.mpaas.demo.nebula.provider in production, as it causes 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.

    public class H5NebulaFileProviderImpl implements H5NebulaFileProvider {
     private static final String TAG = "H5FileProviderImpl";
    
     @Override
     public Uri getUriForFile(File file) {
         try {
             return getUriForFileImpl(file);
         } catch (Exception e) {
             H5Log.e(TAG, e);
         }
         return null;
     }
    
     private static Uri getUriForFileImpl(File file) {
         Uri fileUri = null;
         if (Build.VERSION.SDK_INT >= 24) {
             fileUri = NebulaDemoFileProvider.getUriForFile(LauncherApplicationAgent.getInstance().getApplicationContext(), "com.mpaas.demo.nebula.provider", file);
         } else {
             fileUri = Uri.fromFile(file);
         }
         return fileUri;
     }
    }
  2. Register the H5NebulaFileProvider.

    After mPaaS initialization, register the H5NebulaFileProvider before starting the offline package. A single registration takes effect globally.

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

How to depend on and use mPaaS in library?

To reuse an mPaaS module across projects, add it as a dependency. The following example demonstrates this with the scan module.

Prerequisites

The project is integrated with mPaaS in native AAR mode.

Procedure

  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("com.mpaas.android:$mpaas_artifact:$mpaas_baseline"). The example is as follows:

     dependencies {
         ……
         //This line is necessary when using mPaaS in the module.
         api platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline")
    
         ……
      }
  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.

     plugins {
         id 'com.android.application'
    
         ......
         // baseline.config (baseline) must be added in the build.gradle file of app module.
         id 'com.alipay.apollo.baseline.config'
     }
  5. Call module.

    Import scan module where it is used.

     dependencies {
         api platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline")
    
         ....
         api project(':scan')//scan module
     }

How to fix 608 errors at runtime or native errors with libsgmain

If you encounter a 608 error code or a native error from libsgmain at runtime, search for the keyword SecExcetpion in the Android Studio log and follow these steps to troubleshoot.

  1. Check if the res/drawable/yw_1222.jpg file exists.

    • Check the config file for Base64.

    • Check if the Gradle plugin baseline.update or baseline.config is applied.2

  2. Check META-INF for three files, CERT.SF, MANIFEST.MF, and CERT.RSA.

  • Turn on v1SignEnabled in app/build.gradle.

  • Whether there is apply plugin: 'com.alipay.apollo.optimize' in build.gradle in the project root directory.3

If all checks pass but the issue persists, the signed APK package uploaded to the console may have an incorrect signature. Re-upload the APK package with the correct signature.