tencent cloud

Feedback

Android FAQs

Last updated: 2024-11-21 17:39:37

    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) // Ignore the package name verification
    .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 {
    // Configure module name: Define a unique name following Android class naming rules
    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();
    
    // Register all modules defined above; the registerModule value should match the tcmppModuleName defined earlier
    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.
    /**
    * Return the buttons in the "More" panel. Each button must be assigned an ID, and the ID value should be an integer between 100 and 200.
    * Note: This method is called in the mini program process.
    * @param builder
    * @return
    */
    public ArrayList<MoreItem> getMoreItems(MoreItemList.Builder builder){
    builder.addDebug("Debug", icon) // Set the Debug button on the control panel
    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.
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support