Problem description
The app displays a toast message, "Application update error (50002)", when scanning an mPaaS miniapp QR code.
Common causes
The normal flow for real-device debugging by scanning a QR code is as follows:
A QR code is generated in the miniapp IDE for the mobile client to scan. The miniapp package is also uploaded to the miniapp publishing module in the mPaaS console.
After the mobile client scans the QR code, it sends a Remote Procedure Call (RPC) request to pull the AMR file from the console.
If the system fails to retrieve the miniapp information after calling the MDS miniapp update API, the "Application update error (50002)" message appears.
Possible causes for this issue include the following:
The server-side package is not published.
The uploaded miniapp is not published in the console.
The miniapp was just published, but the server has not yet received it.
The client version is out of the specified range.
The request information does not match the publishing rules on the server.
Troubleshooting steps
Filter the logs. In the Android Studio console, filter the log messages by the keyword `DynamicRelease`. Check if `UnionResourceInfo` contains item information.
Normally, it contains item information. The following is an example:
UnionResourceResult{success=true, message=success, info=[UnionResourceInfo{bizType=NEBULA, success=true, rollback=false, item=[UnionResourceItem{resId=2021011520210115, resVersion=1.0.5.1, fileMD5=9a31d39d20301b74c93317e75f36dd58, fileUrl=https://mcube-prod.oss-cn-hangzhou.aliyuncs.com/ONEX4CFD5B3081617-default/2021011520210115/1.0.5.1_all/nebula/2021011520210115_1.0.5.1.amr, downloadType=CDN, storeType=MEM, resStatus=1, resExtraData=[UnionExtraData{key=app_type, value=1}, UnionExtraData{key=resType, value=4}, UnionExtraData{key=autoinstall, value=1}, UnionExtraData{key=fallbackbaseurl, value=https://mcube-prod.oss-cn-hangzhou.aliyuncs.com/ONEX4CFD5B3081617-default/2021011520210115/1.0.5.1_all/nebula/fallback/}, UnionExtraData{key=scene, value=DEBUG}...,If it does not contain item information, an exception has occurred. The following is an example:
[URGENT_DISP_12] mpaas_url = https://cn-hangzhou-component-gw.cloud.alipay.com/mgw.htm DynamicRelease: [NetworkThread#1] DynamicReleaseLauncher rpc time: 1611736340256 DynamicRelease: [URGENT_DISP_12] rpc result: UnionResourceResult{success=true, message=success, info=[UnionResourceInfo{bizType=NEBULA, success=true, rollback=false, quickRollback=0}]}
Check the configuration for real-device preview and debugging. Follow the steps in "Android miniapp real-device preview and debugging" to verify that the configuration is correct.
Check the client version range. The version number corresponds to the `versionName` value in the Android project. The miniapp can be pulled only if the current app version is between the minimum and maximum versions. If the version is outside this range, the app fails to pull the miniapp on startup and reports an "Application update error". For the minimum version, enter `0.0.0.0`. Leave the maximum version field blank to represent infinity.
NoteWhen you upload, preview, or debug a miniapp on a real device from the miniapp IDE, the miniapp is automatically uploaded to the console. You do not need to modify the configuration in the console. When you create a miniapp, do not add the miniapp package from the miniapp publishing module. This prevents main path inconsistencies. To modify the miniapp, make changes in the miniapp IDE.
Check the main entry path. Verify that the main entry path of the miniapp in the mPaaS console is the same as the main entry path in the miniapp IDE. The default format for the main path in the mPaaS console is
/index.html#xxx/xxx/xxx/xxx, wherexxx/xxx/xxx/xxxafter#is the first value ofpagesin the miniapp'sapp.jsonfile.
If the issue persists, prepare a demo project that reproduces the problem and join the DingTalk group 145930007362 for assistance.