I'm playing with AOSP, and trying to apply OTA package
1). I built AOSP for Google Pixel and installed it
2). I created simple app, which downloads OTA package, and trying to apply it (It's based on this article: http://jhshi.me/2013/12/13/how-to-apply-downloaded-ota-package/index.html)
I'm calling
RecoverySystem.installPackage(getContext(), file);
, and it gets me
java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.os.IRecoverySystem.setupBcb(java.lang.String)' on a null object reference
at android.os.RecoverySystem.setupBcb(RecoverySystem.java:895)
at android.os.RecoverySystem.installPackage(RecoverySystem.java:496)
at android.os.RecoverySystem.installPackage(RecoverySystem.java:421)
Can anyone point me how to fix it please?
As far as I can see, your error comes from this piece of code:
In RecoverySystem.java:
....
In the first piece of code, the if evaluation, your error is
rs
has it'smService
member asnull
. Which is used in the ''setupBcb` method. So it looks like the context you are using does NOT have Context.RECOVERY_SERVICE reachable somehow.Are you using activity context? I would git Application Context a try.