前兩天我們的應用要集成到手機裏作爲系統應用添加了如下屬性
android:directBootAware="true"
android:defaultToDeviceProtectedStorage="true"
然後打開webview就報錯如下;
java.lang.RuntimeException: Unable to start activity ComponentInfo{-------}: android.view.InflateException: Binary XML file line #14: Binary XML file line #14: Error inflating class android.webkit.WebView
---
Caused by: android.view.InflateException: Binary XML file line #14: Binary XML file line #14: Error inflating class android.webkit.WebView
09-25 15:12:44.364 25765 25765 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #14: Error inflating class android.webkit.WebView
09-25 15:12:44.364 25765 25765 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
09-25 15:12:44.364 25765 25765 E AndroidRuntime:
Caused by: java.lang.IllegalArgumentException: WebView cannot be used with device protected storage
原因:webview不能與設備保護存儲一起使用
解決方案:
去掉:android:directBootAware="true" android:defaultToDeviceProtectedStorage="true"
哈哈?