uni-app icon indicating copy to clipboard operation
uni-app copied to clipboard

Android 's hotfix update failed,but IOS worked well

Open dcuser02 opened this issue 1 year ago • 5 comments

问题描述 [问题描述:尽可能简洁清晰地把问题描述清楚] Hello,i packaged a "wgt" hotfix with hbuilderx,but when updating in android,it crached and didn't restart. The same "wgt" hotfix worked well in IOS. Finally,i packaged the hbuilderx 's demo template project for a wgt and android apk. But the same crash happended again. 复现步骤 [复现问题的步骤]

  1. 启动 '...' Start the android app

  2. 点击 '....' Wait for the install of the wgt

  3. 查看 Crashed [或者可以直接贴源代码] // App.vue export default { onLaunch: function() { console.log('App Launch')

     	  uni.downloadFile({  
     	                    url: 'app.wgt',      //Sorry ,the url is private ,so this is a example
     	                    success: (downloadResult) => {  
     	                        if (downloadResult.statusCode === 200) {  
     	                            plus.runtime.install(downloadResult.tempFilePath, {  
     	                                force: true  
     	                            }, function() {  
     	                                console.log('install success...');  
     	                                plus.runtime.restart();  
     	                            }, function(e) {  
     	                                console.error('install fail...');  
     	                            });  
     	                        }  
     	                    }  
     	                });  
    
     },
     onShow: function() {
     	console.log('App Show')
     },
     onHide: function() {
     	console.log('App Hide')
     }
    

    } 预期结果 [使用简洁清晰的语言描述你希望生效的预期结果] Installed the new hotfix and restart 实际结果 [这里请贴上你的报错截图或文字] BOARD:bengal BOOTLOADER:unknown BRAND:Redmi CPU_ABI:arm64-v8a CPU_ABI2: DEVICE:tapas DISPLAY:TKQ1.221114.001 test-keys FINGERPRINT:Redmi/tapas_global/tapas:13/TKQ1.221114.001/V14.0.14.0.TMTMIXM:user/release-keys HARDWARE:qcom HOST:pangu-build-component-system-325662-czdzx-9m0ls-94f6z ID:TKQ1.221114.001 IS_DEBUGGABLE:false IS_EMULATOR:false IS_MIUI:true MANUFACTURER:Xiaomi MODEL:23021RAAEG ODM_SKU:m7g PERMISSIONS_REVIEW_REQUIRED:true PRODUCT:tapas_global RADIO:unknown SERIAL:unknown SKU:unknown SOC_MANUFACTURER:QTI SOC_MODEL:SM6225 SUPPORTED_32_BIT_ABIS:[Ljava.lang.String;@cf45f9d SUPPORTED_64_BIT_ABIS:[Ljava.lang.String;@99cbc12 SUPPORTED_ABIS:[Ljava.lang.String;@f5bfe3 TAGS:release-keys TIME:1694070981000 TYPE:user UNKNOWN:unknown USER:builder java.lang.NullPointerException: Attempt to read from null array at io.dcloud.feature.pdr.RuntimeFeatureImpl$a.run(Unknown Source:9) 系统信息:

  • 发行平台: [如 微信小程序、H5平台、5+ App等]
  • Android
  • 操作系统 [如 iOS 12.1.2、Android 7.0]
  • Android 13TKQ1.221114.001
  • HBuilderX版本 [如使用HBuilderX,则需提供 HBuilderX 版本号]
  • 3.98
  • uni-app版本 [如使用Vue-cli创建/运行项目,则提供npm run info的运行结果]
  • 设备信息 [如 iPhone8 Plus] Redmi Note 12

补充信息 [可选] [根据你的分析,出现这个问题的原因可能在哪里?]

dcuser02 avatar Dec 29 '23 06:12 dcuser02

Hello,I tried packaged a "wgt"hotfix with hbuilderx,and downloaded wgt like your code,it worked well in IOS and Android.Please check whether it is compatible with Android in your "wgt" package

18148764734 avatar Jan 05 '24 12:01 18148764734

Thank you.I found that wgt can be installed normally in debug mode. But, the apk package after cloud packaging failed to install wgt.

dcuser02 avatar Jan 07 '24 16:01 dcuser02

What is you Android version ? Will this issue occur on other models?

18148764734 avatar Jan 08 '24 07:01 18148764734

I also encountered an issue when hot updating the widget for Android. How can I resolve this problem? I have searched through a lot of documentation but have not yet succeeded in doing it.

bruceleeTamky avatar Feb 04 '24 05:02 bruceleeTamky

@18148764734 When running with a virtual machine, everything works fine. However, when building for production using cloud packaging with Hbuilder X 3.99, the app crashes when calling plus.runtime.install(downloadres.tempFilePath, {}, (e) => {.... Here is the code I have implemented: const task = uni.downloadFile({ url: updateInfo.downloadUrl, success: (downloadres) => { if (downloadres.statusCode !== 200) { uni.$emit(DOWNLOAD_UPGRADE_FAILED); return; }

	plus.runtime.install(downloadres.tempFilePath, {}, (e) => {
		console.log('install success', updateInfo.versionCode, updateInfo.version);
		uni.setStorageSync(APP_VERSION_CODE, updateInfo.versionCode);
		uni.setStorageSync(APP_VERSION, updateInfo.version);
		plus.runtime.restart();
	}, (err) => {
		console.log(err)
		uni.$emit(INSTALLED_UPGRADE_FAILED, err);
	})
}

}); I think the issue might be due to downloadres.tempFilePath being incorrect or Android being unable to access it.

bruceleeTamky avatar Feb 04 '24 05:02 bruceleeTamky