我们的android webview webapp可以在所有设备上运行,没有任何问题。在特定设备不工作并显示“系统ui已停止”时,日志位于:
12-11 10:24:12.071 19640-19640/? I/chromium: [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest https://app.powerbi.com/OfflineSupport/ManifestDashboard/cache.manifest", source: https://app.powerbi.com/dashboard?manifest=OfflineSupport%2FManifestDashboard%2Fcache.manifest&clusterUri=https%3A%2F%2Fapi.powerbi.com%2F&hostType=android&disableClientTelemetry=true (0)
12-11 10:24:12.071 19640-19640/? I/chromium: [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://app.powerbi.com/dashboard?manifest=OfflineSupport%2FManifestDashboard%2Fcache.manifest&clusterUri=https%3A%2F%2Fapi.powerbi.com%2F&hostType=android&disableClientTelemetry=true (0)
12-11 10:24:15.521 19640-19640/? I/chromium: [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: https://app.powerbi.com/dashboard?manifest=OfflineSupport%2FManifestDashboard%2Fcache.manifest&clusterUri=https%3A%2F%2Fapi.powerbi.com%2F&hostType=android&disableClientTelemetry=true (0)
12-11 10:24:17.081 19640-19640/? I/chromium: [INFO:CONSOLE(136)] "TypeError: Cannot read property 'AccessToken' of undefined
at https://app.powerbi.com/13.0.1700.762/scripts/powerbimobilecommon.min.js:1:27377
at https://app.powerbi.com/13.0.1700.762/scripts/powerbiportal.dependencies.bundle.min.js:149:20
at m.$eval (https://app.powerbi.com/13.0.1700.762/scripts/powerbiportal.dependencies.bundle.min.js:163:347)
at m.$digest (https://app.powerbi.com/13.0.1700.762/scripts/powerbiportal.dependencies.bundle.min.js:160:422)
at https://app.powerbi.com/13.0.1700.762/scripts/powerbiportal.dependencies.bundle.min.js:163:435
at e (https://app.powerbi.com/13.0.1700.762/scripts/powerbiportal.dependencies.bundle.min.js:63:452)
at https://app.powerbi.com/13.0.1700.762/scripts/powerbiportal.dependencies.bundle.min.js:66:301", source: https://app.powerbi.com/13.0.1700.762/scripts/powerbiportal.dependencies.bundle.min.js (136)
以上网址根本不在我的应用上。
在谷歌搜索后,我添加了这些内容:
final WebSettings webviewSettings = webView.getSettings();
final String appCachePath = this.getCacheDir().getAbsolutePath();
webviewSettings.setAllowFileAccess(true);
webviewSettings.setAppCacheEnabled(true);
webviewSettings.setAppCachePath(appCachePath);
webviewSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
和
12-11 11:57:28.242 31238-31238/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.systemui.recents, PID: 31238
java.lang.OutOfMemoryError: Failed to allocate a 20492 byte allocation with 6912 free bytes and 6KB until OOM
at java.lang.reflect.Array.createMultiArray(Native Method)
at java.lang.reflect.Array.newInstance(Array.java:335)
at android.app.ApplicationPackageManager.getAppIconAlphaRelativeScale(ApplicationPackageManager.java:2989)
at android.app.ApplicationPackageManager.getThemeIconWithBG(ApplicationPackageManager.java:3107)
at android.app.ApplicationPackageManager.getThemeIconWithBG(ApplicationPackageManager.java:3037)
at android.app.ApplicationPackageManager.loadUnbadgedItemIcon(ApplicationPackageManager.java:2867)
at android.app.ApplicationPackageManager.loadItemIcon(ApplicationPackageManager.java:2774)
at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:220)
at com.android.systemui.recents.misc.SystemServicesProxy.getActivityIcon(SystemServicesProxy.java:793)
at com.android.systemui.recents.model.RecentsTaskLoader.getAndUpdateActivityIcon(RecentsTaskLoader.java:463)
at com.android.systemui.recents.model.RecentsTaskLoadPlan.executePlan(RecentsTaskLoadPlan.java:279)
at com.android.systemui.recents.model.RecentsTaskLoader.loadTasks(RecentsTaskLoader.java:621)
at com.android.systemui.recents.Recents.onStart(Recents.java:393)
at com.android.systemui.recents.Recents.handleProxyCall(Recents.java:822)
at com.android.systemui.recents.Recents.handleProxyCall(Recents.java:744)
at com.android.systemui.recents.Recents.start(Recents.java:347)
at com.android.systemui.recents.Recents.getInstanceAndStartIfNeeded(Recents.java:322)
at com.android.systemui.recents.RecentsService.onCreate(RecentsService.java:39)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3807)
at android.app.ActivityThread.access$2100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
12-11 11:57:30.172 20255-28583/? E/SCLOUD_ERR-AuthControl_[CT86173145]: TID : [97332] auth exception
com.samsung.android.scloud.framework.PDMException: auth data is not valid.., eCode : 305
at com.samsung.android.scloud.auth.result.AuthControl$1.run(AuthControl.java:54)
at java.lang.Thread.run(Thread.java:818)
但问题仍然存在,请指教。