Troubleshooting mini program startup failures
Mini program startup failures can occur due to the following reasons:
Incorrect configuration file path: The configAssetName should be set to the full path of the file in the assets directory. If the configuration file is in a subdirectory, include the directory path, e.g., server/tcmpp-android-configurations.json.
Modification of configuration file: Do not modify the mini program configuration file, as this will prevent the mini program from running correctly.
Package name mismatch: The packageName in the configuration file must match the application's applicationId . The app will fail to run if they do not match because the packageName is verified during initialization. You can disable package name verification with the following setting:
MiniInitConfig config = builder
.verifyPkg(false)
.build();
Initialization annotation: Ensure that the initialization annotation @ProxyService has generated the ExtProxyServiceScope class.
How does the SDK ensure privacy compliance?
The mini program SDK initializes when the developer calls methods from the TmfMiniSDK class. Therefore, you should call these methods only after the user has given consent for privacy compliance.
How to troubleshoot errors in custom mini program APIs?
Check if XxxJsPluginScope is generated in the compilation path, as shown below:
Check if the event names defined on the client side match the method names called in the mini-program.Note that custom mini-program API event names are case-sensitive.
Mini program domain and privacy API verification logic
The mini program will verify the legitimacy of domain name requested by the API. If the privacy API is set in the management backend, authorization check will also be performed. However, verification is skipped in the following scenario:
The mini program is running in an unreleased version and the mini program debugging is enabled. See Mini program debugging. Modular project support
When developers use the annotations @JsPlugin or @ProxyService in multiple modules within a modular project, the following error may occur during the Make Project process:
To support multi-module projects, configure as follows:
1. Add the following code to the build.gradle file of each module using the @JsPlugin or @ProxyService annotation:
android {
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = [tcmppModuleName: "Demo"]
}
}
}
}
2. Register the module in the initialization code:
@ProxyService(proxy = MiniConfigProxy.class)
public class MiniConfigProxyImpl extends MiniConfigProxy {
@Override
public MiniInitConfig buildConfig() {
MiniInitConfig.Builder builder = new MiniInitConfig.Builder();
return builder
How to view SDK log output?
1. Developers can filter SDK logs using the keyword TMF_MINI in the development tools.
2. View mini program JS error logs.
Method 1: Filter JS logs using the keyword MINI_JS_LOG.
Method 2: Debug mini program JS errors in Chrome.
How to enable mini program debugging mode?
To facilitate debugging and viewing log outputs, the client needs to enable the mini program debug entry. See Customize mini program SDK API - Customize more buttons.
public ArrayList<MoreItem> getMoreItems(MoreItemList.Builder builder){
builder.addDebug("Debug", icon)
return builder.build();
}
A Debug button is displayed on the mini program control panel. Click the button, and restart the mini program to enter the debugging mode.
Does the mini program SDK automatically clear mini program package cache?
No, developers need to manually call the mini program SDK's deletion methods to clear the mini programs package cache (Deleting mini programs). If not, the host app's cache will increase as the number of mini program used increases. Why can't I use the mini program normally after enabling the R8 full mode?
R8 full mode obfuscation uses stricter rules, which can cause some annotations in older versions of the mini-program SDK to be lost, potentially preventing the mini-program from starting correctly. Starting from Android Gradle Plugin version 8.0, R8 full mode is enforced during compilation. Please upgrade the mini program SDK mini_core to version 2.0.5 or later to be compatible with the R8 full mode.
Was this page helpful?