Posts in 2025
-
Fix Android fastboot flash 'Could not open super partition'
in Android
This guide addresses the issue of encountering the error
'Could not open super partition'
when flashing a Pixel device using theflash-all.sh
script.Symptom When flashing a Pixel device using the flash-all.sh script, the process fails with the 'Could not open super partition' error: $ ./flash-all.sh Warning: skip copying bootloader_a image avb footer (bootloader_a partition size: 0, bootloader_a …
Posts in 2021
-
Android OkHttp change User-Agent header
in Android
Android OkHttp addHeader(“User-Agent”) does not work troubleshooting.
Symptom Use OkHttpClient.Builder() to add User-Agent header. val okHttpClient = OkHttpClient.Builder() .addNetworkInterceptor { chain -> val requestBuilder = chain.request().newBuilder() .addHeader("User-Agent", userAgent) With this code, …
-
Various ways to load PDF in Android webview
Last Update: in Android
Android webview can not load PDF file by default. Luckily, there are various ways to how to load PDF file in Android webview, like use google service, pdf.js etc.
Pain point: By default, Android WebView cannot load PDF files. :( Luckily, there are various ways to how to load PDF file in Android webview. Open Intent with startActivity If your requirement does not need use embedded webview to show PDF, you can …
-
Weird Android junit test failure java.lang.NoClassDefFoundError: android/content/Context
in Android
Symptom Have a Android project run junit test fine, suddenly it failed to run unit test with following error: xxxxTest initializationError java.lang.NoClassDefFoundError: android/content/Context at java.lang.Class.getDeclaredMethods0(Native Method) …