android11系统升级 java.lang.NullPointerException: Attempt to invoke interface method ‘boolean android

1,在目录下``out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar改名得到 framework.jar 把framework.jar 复制到Androidstudio项目目录的libs文件夹下;鼠标点击右键,选择Add As Library ,接着选择framework.jar 所在的module,即可在module的build.gradle自动引入framework.jar
把implementation改为compileOnly ,这样做得目的是 framework.jar只在编译阶段使用,打包apk时候不打包进入,可以减小apk包的大小;
在project的build.gradle中的allprojects闭包中添加

java.lang.NullPointerException: Attempt to invoke interface method ‘boolean android.os.IUpdateEngine.bind(android.os.IUpdateEngineCallback)’ on a null object reference

(standard input):4838:05-13 09:50:48.563  3590  6403 I ActivityTaskManager: START u0 
{act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 
pkg=com.example.android.systemupdatersample 
cmp=com.example.android.systemupdatersample/.ui.MainActivity} from uid 1000
(standard input):4844:05-13 09:50:48.708  3590  3629 I ActivityManager: Start proc 
6998:com.example.android.systemupdatersample/u0a58 for activity 
{com.example.android.systemupdatersample/com.example.android.systemupdatersample.ui.MainActivity}
(standard input):4864:05-13 09:50:49.189  6998  6998 E AndroidRuntime: Process: 
com.example.android.systemupdatersample, PID: 6998
(standard input):4865:05-13 09:50:49.189  6998  6998 E AndroidRuntime: java.lang.RuntimeException: 
Unable to start activity 
   ComponentInfo
   {com.example.android.systemupdatersample/com.example.android.systemupdatersample.ui.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'boolean 
  android.os.IUpdateEngine.bind(android.os.IUpdateEngineCallback)' on a null object reference
  standard input):4881:05-13 09:50:49.189  6998  6998 E AndroidRuntime:  at 
  com.example.android.systemupdatersample.ui.MainActivity.onCreate(MainActivity.java:110)
  (standard input):4887:05-13 09:50:49.195  3590  6403 W ActivityTaskManager:   Force finishing activity 
  com.example.android.systemupdatersample/.ui.MainActivity
  (standard input):4903:05-13 09:50:49.290  3590  6914 I ActivityManager: Process 
  com.example.android.systemupdatersample (pid 6998) has died: vis+99 TOP
  (standard input):4912:05-13 09:50:49.697  3590  3622 W ActivityTaskManager: Activity top resumed state 
   loss timeout for ActivityRecord{462c162 u0 com.example.android.systemupdatersample/.ui.MainActivity t-1 f}

So your bind is failing, this could have several causes:

Your update_engine service is not running in Android. I’ve found that the update_engine service does not appear to be working on some Emulators. To check the update_engine service using adb shell you can search for the service:
ucm_imx8m_mini:/ ps -A | grep update
root 2917 1 23004 8812 SyS_epoll_wait 0 S update_engine
You can also verify that the update_engine_client command can connect/bind to the service:

ucm_imx8m_mini:/ update_engine_client --follow                                                                                                                                                
[INFO:update_engine_client_android.cc(90)] onStatusUpdate(UPDATE_STATUS_IDLE (0), 0)

Your app isn’t signed as a system app and therefore can’t access the service.

Your app’s manifest doesn’t specify the system sharedUserID property, e.g.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.horizonemb.simplesystemapp"
    android:sharedUserId="android.uid.system">
...
</manifest>

If none of these work, do check the With the privileged system permissions section of Google’s updater_sample example

**

没有添加系统进程,远程服务未启动

**

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值