Review the following list of frequently asked questions. Click a question to see the answer.
No network connectivity at compile-time
A missing or blocked network connection during compilation causes the build to fail. Check each of the following:
Confirm you have an active internet connection.
Confirm no network proxy is active, including browser proxies and third-party proxy software.
-
Confirm no IDE proxy is configured.

In
gradle.properties, confirm that no Gradle proxy is set—specifically, thatsystemProp.http.proxyHostandsystemProp.http.proxyPortare absent. If either property exists, delete it.
Program compilation failed
Work through these steps in order to identify and fix the root cause of a compilation failure.
Follow the steps in No network connectivity at compile-time to rule out network issues.
Check the Gradle execution log to confirm the new dependency is valid.
-
Verify that the
group,artifact, andversion(GAV) parameters of the dependency are correct.// Reference the debug package group:artifact:version:raw@jar bundle "com.app.xxxxx.xxxx:test-build:1.0-SNAPSHOT:raw@jar" // Reference the release package group:artifact:version@jar bundle "com.app.xxxxx.xxxx:test-build:1.0-SNAPSHOT@jar" manifest "com.app.xxxxx.xxxx:test-build:1.0-SNAPSHOT:AndroidManifest@xml" -
Run the following command from your system's command line to export the Gradle execution log:
# Before you run the command, confirm that the productflavor property is not defined. Otherwise, the command will fail. # The following command exports the execution log to the log.txt file. gradle buildDebug --info --debug -Plog=true > log.txt -
Open the exported log file. An entry like the following means the dependency was not found—the key line is the URL shown under "Searched in the following locations":
Caused by: org.gradle.internal.resolve.ArtifactNotFoundException: Could not find nebulacore-build-AndroidManifest.xml (com.alipay.android.phone.wallet:nebulacore-build:1.6.0.171211174825). Searched in the following locations: http://mvn.cloud.alipay.com/nexus/content/repositories/releases/com/alipay/android/phone/wallet/nebulacore-build/1.6.0.171211174825/nebulacore-build-1.6.0.171211174825-AndroidManifest.xml at org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult.notFound(DefaultBuildableArtifactResolveResult.java:38) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$LocateInCacheRepositoryAccess.resolveArtifactFromCache(CachingModuleComponentRepository.java:260) -
Open the HTTP URL from the log in a browser and sign in to the Maven repository to confirm whether the artifact exists.
NoteYou can find the username and password in the
build.gradlefile. -
Run the following command to clear the
gradlecache:gradle clean --refresh-dependencies -
If the artifact exists in the Maven repository, delete the local Gradle cache and recompile:
-
On macOS, Linux, or Unix, run:
cd ~ cd .gradle cd caches rm -rf modules-2 On Windows, navigate to
C:\Users\{username}\.gradle\cachesand delete themodules-2folder.
-
Slowdowns during compilation
If compilation takes more than 20 minutes, work through the following steps to speed it up.
Follow the steps in the previous section to confirm you have a stable network connection.
Confirm the firewall is disabled.
Confirm no network proxy is configured in IntelliJ IDEA.
-
Pre-configure the Maven repository in your build script. The following example loads the Alibaba Cloud Maven mirror first, which reduces resolution latency:
apply plugin: 'maven' buildscript { repositories { mavenLocal() // First, load the Maven mirror maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} maven { credentials { username "Use a known user" password "Use a known password" } url "http://mvn.cloud.alipay.com/nexus/content/repositories/releases/" } } dependencies { classpath 'com.android.tools.build:gradle:2.1.3' classpath 'com.alipay.android:android-gradle-plugin:2.1.3.3.3' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { flatDir { dirs 'libs' } mavenLocal() maven { credentials { username "xxxxxxxxx" password "xxxxxxx" } url "http://mvn.cloud.alipay.com/nexus/content/repositories/releases/" } maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} } }
Compilation fails with a NullPointerException

When connecting to Apsara Stack, the build can fail with a NullPointerException after you download the configuration file and connect to mPaaS. Inspect the configuration file and verify that all 13 required fields are present and that field names match those in the file downloaded from the public cloud.
How to debug an application
Two methods are available for debugging your application during development:
Start the application in debug mode
Debug the application after it is running
Start the application in debug mode
-
Scenarios
Use this method when you need to debug initialization code that runs at startup, such as
application init. Procedure
-
Run
adb shell am start -W -S -D <application_package_name>/<first_activity_class_name>. For the mPaaS Demo, the package name iscom.mpaas.demoand the first activity class name iscom.alipay.mobile.quinox.LauncherActivity, so the full command isadb shell am start -W -S -D com.mpaas.demo/com.alipay.mobile.quinox.LauncherActivity. The first activity class name is shown in the figure below.
-
After running the command, a dialog box appears on your device.

-
Set a breakpoint on the target line of code, then attach to the application's process as shown.

Debug the application after it is running
-
Scenarios
Use this method when you need to debug after a user interaction, such as clicking a button or navigating to a page.
-
Procedure
Once the application is running, click the Attach to process (
) button to start debugging.
Notes on using MultiDex in mPaaS Portal and Bundle projects
Avoid using MultiDex in Portal and Bundle projects. The only supported exception is a single portal project that requires multiDexEnabled true. If a Bundle grows too large, split it into smaller bundles rather than enabling MultiDex.
How to clear the Gradle cache
Open the Gradle plugin settings and click Clean Cache to delete all cached data.

How to upgrade to the latest Gradle plugin
This section applies only to the 10.1.68 baseline series. For more information about this baseline version, see Baseline introduction and 10.1.68 baseline series release notes.
The official Android Gradle Plugin from Google is version 3.5.x. mPaaS provides a compatible plugin at the same version, supporting Google Android Gradle Plugin 3.5.3 APIs and Gradle 6.2.
Changes to the import method
-
Add only the following dependency to import the mPaaS plugin. The official Android Gradle Plugin is pulled in automatically via transitive dependencies—you do not need to declare it separately.
dependencies { classpath 'com.alipay.android:android-gradle-plugin:3.5.18' } Use Gradle Wrapper version 5.6 or later. Version 6.2 is recommended.
Changes to usage
-
Remove
apply plugin:'com.android.application'and replace it with the appropriate mPaaS plugin:For a portal project, use
apply plugin:'com.alipay.portal'.For a bundle project, delete
apply plugin:'com.android.application'and use onlyapply plugin:'com.alipay.bundle'.For a library project, delete
apply plugin:'com.alipay.library'and use onlyapply plugin:'com.android.library'.
If you use Android Studio 3.5 or later, add
android.buildOnlyTargetAbi=falsetogradle.properties.-
The mPaaS Security Guard component does not support V2 signing. Disable V2 signing in these cases:
When debugging or installing the APK via Android Studio
When building from the command line with
minSdkVersion24 or higher
To disable V2 signing, add the following to your signing configuration:
v2SigningEnabled false
After clearing the cache, monitor and confirm that the miniapp and H5 pages work as expected.
The input file tag cannot open the camera on Huawei EMUI 10
Huawei EMUI 10 uses a non-standard URI implementation that prevents the <input file> tag from opening the camera. Apply all three of the following fixes.
1. Upgrade the baseline
If you are on the 32 series baseline, upgrade to 10.1.32.18 or later.
If you are on the 60 series baseline, upgrade to 10.1.60.9 or later.
If you are on the 68 series baseline, upgrade to 10.1.68-beta.3 or later.
2. Configure FileProvider
You can reuse an existing FileProvider or create a new one.
-
Create a Java class that extends FileProvider:
import android.support.v4.content.FileProvider; public class NebulaDemoFileProvider extends FileProvider { } -
In
res/xml, create a file namednebula_fileprovider_path.xml:<?xml version="1.0" encoding="utf-8"?> <paths xmlns:android="http://schemas.android.com/apk/res/android"> <external-path name="external" path="."/> </paths> -
Register the provider in
AndroidManifest.xml:<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>NoteThe value of
android:authorities,com.mpaas.demo.nebula.provider, is taken from the mPaaS demo. Set this to a value unique to your application—do not usecom.mpaas.demo.nebula.provider, as it will conflict with other mPaaS applications.
3. Implement H5NebulaFileProvider
-
Create a Java class that implements
H5NebulaFileProviderand override thegetUriForFilemethod. In the method body, delegate to theFileProvideryou created above to generate the 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; } } -
Register
H5NebulaFileProvider. After mPaaS initialization completes and before starting the offline package, registerH5NebulaFileProvider. This registration is global and only needs to be done once:H5Utils.setProvider(H5NebulaFileProvider.class.getName(), new H5NebulaFileProviderImpl());
How to use or depend on mPaaS in a Library
When you need to reuse an mPaaS component across modules, add it as a library dependency. This procedure uses the mPaaS Scan component as an example.
Prerequisites
Your project is connected to mPaaS using the native AAR method.
Procedure
In your Android project, create an Android Library module named
scan.
-
In the
build.gradlefile of the newscanmodule, addapi platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline"):dependencies { …… // This must be added when using mPaaS component features in a module. api platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline") …… } Use the mPaaS plugin in Android Studio to install the Scan component for the
scanmodule: go to mPaaS > Native AAR Connection > Configure/Update Component > Start Configuration. The Scan component loads automatically after installation.-
In the main app's
build.gradle, add the baseline config plugin:plugins { id 'com.android.application' ...... // You must add baseline.config (baseline) to the build.gradle file under app. id 'com.alipay.apollo.baseline.config' } -
In the module where you need the Scan component, add the
scanmodule as a dependency:dependencies { api platform("com.mpaas.android:$mpaas_artifact:$mpaas_baseline") .... api project(':scan')// Scan component }
How to resolve runtime error 608 or libsgmain native errors
Search for SecException in the Android Studio log. If you find error code 608 or a libsgmain native error, work through the following checks.
-
Verify the
res/drawable/yw_1222.jpgfile exists and is valid:Confirm the configuration file contains Base64-encoded data.
Confirm the Gradle plugin
baseline.updateorbaseline.configis applied.
-
Check that the META-INF folder contains all three signing files:
CERT.SF,MANIFEST.MF, andCERT.RSA:In
app/build.gradle, enablev1SignEnabled.Confirm the project root
build.gradlecontainsapply plugin: 'com.alipay.apollo.optimize'.
If all checks pass, the issue is likely a signature error in the APK uploaded to the console. Upload the APK package again.

) button to start debugging.


