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
**
没有添加系统进程,远程服务未启动
**