Common access issues and solutions for Android Portal&Bundle projects, including compilation failures, stuttering, NullPointerException errors, debugging, MultiDex usage, and Gradle cache and plugin upgrades.
No network connection at compile time
A missing network connection during compilation often causes build failures. Perform the following steps to verify that the compilation environment has network connectivity.
-
Confirm that you are connected to the Internet.
-
Confirm that no network proxy is connected, including browser proxy settings and third-party network proxy software.
-
Verify that the IDE proxy is not set.

-
In the
gradle.propertiesfile, verify that the Gradle proxy is not set, that is, thesystemProp.http.proxyHostandsystemProp.http.proxyPortproperties are not set. If you have specified the property, delete the property.
Program compilation failed
If the program fails to compile, perform the following steps to troubleshoot the error:
-
Make sure that the network in the compilation environment is properly connected based on the No network connection at compile time.
-
Check the Gradle execution records to confirm that the added dependencies are valid.
-
Check whether the GAV(
group,artifact,version) parameters of the dependency are correctly set.// 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" -
In the built-in command line tools, run the following command to export Gradle execution records:
// Before you run the command, make sure that the productflavor attribute is not defined. Otherwise, the command will fail to run. // Run the following command to export execution records to the log.txt file. gradle buildDebug --info --debug -Plog=true > log.txt -
View the record file exported in step 4. In the latest generated record, you will see a record similar to the following, indicating that the added dependency does not exist.
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) -
Visit the HTTP link in this record (as shown in line 3 of the record listed in the previous step) and log in to view the Maven repository.
NoteYou can view the account name and password required for login in the
build.gradlefile. -
Run the following command to refresh the
gradlecache:gradle clean --refresh-dependencies -
If the Maven repository has corresponding dependencies, delete the Gradle cache in the personal directory and recompile. You can delete the Gradle cache as follows:
-
Run the following command in a system such as macOS, Linux, and Unix.
cd ~ cd .gradle cd caches rm -rf modules-2 -
In Windows, the default path is
C:\Users \\{ username }\\.gradle\cachesand themodules-2folder is deleted.
-
Stuttering occurs during compilation
If the compilation process stalls for more than 20 minutes, perform the following steps to improve compilation efficiency.
-
According to the above steps, confirm that the compilation environment network is connected normally.
-
Verify that the firewall is disabled.
-
Make sure that the network configuration of the IntelliJ IDEA compiler is not enabled.
-
In the code, load the Maven image in advance. For example, the following code shows how to load a Maven image from Alibaba Cloud.
apply plugin: 'maven' buildscript { repositories { mavenLocal() // Start loading the Maven image first. maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} maven { credentials { username "Use 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 and NullPointerException occurs
After you download the configuration file and connect to the private cloud, the compilation may fail with a NullPointerException. To resolve this issue, check the fields in the config configuration file. Verify that all 13 required fields are present and that the field names match those in the file downloaded from the public cloud.
How to debug an application
You may need to debug code during development. The following two debugging methods are available.
-
Start the application in debug mode
-
Debug the application after it runs
Start an application in debug mode
-
Scenarios
Debug the initial code that runs when the application starts, such as the initialization code at
application inittime. -
Procedure
-
Run the
adb shell am start -W -S -D application package name /first startup page class name of the applicationcommand. For example, if the package name of mPaaS Demo iscom.mpaas.demoand the first page class name of the application iscom.alipay.mobile.quinox.LauncherActivity, you can use the command lineadb shell am start -W -S -D com.mpaas.demo/com.alipay.mobile.quinox.LauncherActivityto start the application in debugging mode. The following figure shows the name of the first class to start.
-
After you run the command, the following dialog box appears.

-
Set a breakpoint on the line of code that you want to debug, and then attach it to the process where the application is located, as shown in the figure.

Debug an application after it is run
-
Scenarios
Debug after a specific event is triggered, such as clicking a button or navigating to a page.
-
Procedure
After the application is running, click the Attach Process (
) button, or after you run the preceding command, click the Attach button to start debugging.
Precautions for using MultiDex in the mPaaS Portal&Bundle project
We recommend that you do not enable MultiDex for Portal and Bundle projects, unless you have a single portal project that requires multiDexEnabled true. If your bundle is too large, split it into smaller bundles instead of enabling multidex support.
How to clear the Gradle cache
Open the Gradle plug-in settings and click Clean Cache to delete all cached data of the Gradle plug-in.

How to upgrade to the latest Gradle plugin
This section applies only to 10.1.68 series baselines. For more information about baselines of this version, see Baselines overview and 10.1.68 series baselines release notes.
The official Android Gradle Plugin from Google is version 3.5.x.
mPaaS provides a 3.5.x version of the plug-in that supports Google Android Gradle Plugin 3.5.3 and Gradle 6.2 APIs.
Introduction of changes
-
Add the following dependency to introduce the mPaaS plug-in. You do not need to separately introduce the official Android Gradle Plugin because the dependency is transitively included.
dependencies { classpath 'com.alipay.android:android-gradle-plugin:3.5.18' } -
Upgrade the Gradle Wrapper version to 5.6 or later. Version 6.2 is recommended.
Changes in usage
-
apply plugin:'com.android.application'is no longer required.-
For a portal project, use only
apply plugin:'com.alipay.portal'. -
For a bundle project, remove
apply plugin:'com.android.application'and use onlyapply plugin:'com.alipay.bundle'. -
For a library project, remove
apply plugin:'com.alipay.library'and use onlyapply plugin:'com.android.library.
-
-
If you use the latest stable version of Android Studio 3.5 or later, you need to add
android.buildOnlyTargetAbi=falseto yourgradle.properties. -
The wireless bodyguard component does not currently support V2 signatures. If you use Android Studio to debug and install your APK, you must disable V2 signatures. If you build from the command line and your minSdkVersion is 24 or later, you must also disable V2 signatures. Disable V2 signatures as follows:
v2SigningEnabled false
After clearing the cache, verify that mini programs and H5 pages work as expected.

