Qihoo360 / RePlugin

RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework
Apache License 2.0
7.25k stars 1.52k forks source link

2.2.2版本宿主做插件升级的时候,getPendingUpdate().getVersion() 里面空指针崩溃了 #496

Closed Roger-Zhou closed 6 years ago

Roger-Zhou commented 6 years ago

问题详细描述 Detailed description of the problem

宿主升级2.2.2版本,然后测试插件升级流程。2.2.2版本宿主携带一个低版本的2.2.1版本的内置插件, 然后再升级到高版本的2.2.1版本的插件,插件安装后获取pendingUpdate的version,空指针崩溃了

复现问题步骤 Steps to reproduce the problem

  1. 宿主升级到replugin2.2.2版本,携带一个低版本内置2.2.1版本插件
  2. 低版本插件运行后,后台下载升级插件到高版本,也还是2.2.1版本
  3. 进程不启动,获取PendingUpdate的version,运行如下代码崩溃:

PluginInfo curRunInfo = RePlugin.getPluginInfo(mPluginPackageName); PluginInfo pendingInfo = curRunInfo.getPendingUpdate(); if (pendingInfo != null) { int pendingVersion = pendingInfo.getVersion(); // getVersion里面崩溃了 ...... }

其它重要信息 Other important information

replugin-host-lib/gradle Version: 2.2.2 rePlugin-plugin-lib/gradle Version: 2.2.1

Android API Version: api-level : 22 android5.1 Android 手机型号&ROM(Phone model & ROM): Vivo X6Plus D, Funtouch OS_2.5

Logcat上下文 Logcat context

02-01 10:57:36.024 14171-14171/com.xunlei.downloadprovider E/Tinker.TinkerUncaughtExceptionHandler: uncaughtException:Attempt to invoke virtual method 'int org.json.JSONObject.optInt(java.lang.String)' on a null object reference 02-01 10:57:36.025 14171-14171/com.xunlei.downloadprovider W/Tinker.TinkerUncaughtExceptionHandler: tinker is not loaded 02-01 10:57:36.025 14171-14171/com.xunlei.downloadprovider E/Tinker.UncaughtHandler: TinkerUncaughtHandler catch exception:java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONObject.optInt(java.lang.String)' on a null object reference at com.qihoo360.replugin.model.PluginInfo.getVersion(PluginInfo.java:296)

cundong commented 6 years ago

该问题马上修复。

cundong commented 6 years ago

done https://github.com/Qihoo360/RePlugin/commit/3f9cd5b0d0ba4a3c4cf3af44785ef315af30048a

cundong commented 6 years ago

大家要是遇到这个问题,可以仅仅将 replugin-host-lib 修改为 2.2.3 来解决。