简体   繁体   English

Cordova【安卓平台】从API 29迁移到API 30

[英]Cordova [Android platform] migration from API 29 to API 30

I'm trying to migrate my mobile app (developed with Cordova and AngularJS for Android and iOS platforms) and I have some issues from API 29 to API 30. In my app I download from a REST service a JSON catalogue with separated pictures (JPG format) that I store in Data Directory (cordova.file.dataDirectory). I'm trying to migrate my mobile app (developed with Cordova and AngularJS for Android and iOS platforms) and I have some issues from API 29 to API 30. In my app I download from a REST service a JSON catalogue with separated pictures (JPG格式)存储在数据目录(cordova.file.dataDirectory)中。 With the app build with API set to 29 the app works fine, downloading pictures and displaying them in an HTML page (updated with AngularJS).将 API 设置为 29 的应用程序构建应用程序运行正常,下载图片并在 HTML 页面(使用 AngularJS 更新)中显示它们。 But if I try to build it with API set to 30, the app continues to work (it download correctly the json and the jpg files in Data Directory) but without displaying the pictures stored in that directory.但是,如果我尝试将 API 设置为 30 来构建它,该应用程序将继续运行(它会正确下载 json 和数据目录中的 jpg 文件),但不会显示存储在该目录中的图片。 I also tried to create a new simple mobile app using all the updated component (Cordova 10.0.0, Android platform 10.0.0, plugins, etc.) but I obtain the same behaviour and I cannot resolve this issue.我还尝试使用所有更新的组件(Cordova 10.0.0、Android 平台 10.0.0、插件等)创建一个新的简单移动应用程序,但我得到了相同的行为,我无法解决这个问题。 Could you help me or have you an idea how to resolve it?你能帮我或者你知道如何解决它吗?

Info App build with API 29使用 API 构建的 Info App 29

Cordova v8.1.2 Cordova v8.1.2
Android Platform v8.0.0 Android 平台 v8.0.0

Info App build with API 30使用 API 30 构建信息应用程序

Cordova v10.0.0 Cordova v10.0.0
Android Platform v10.0.0 Android 平台 v10.0.0

Plugins List插件列表

cordova-plugin-android-permissions 1.0.2 "Permissions" cordova-plugin-android-permissions 1.0.2“权限”
cordova-plugin-camera 4.1.0 "Camera" cordova-plugin-camera 4.1.0“相机”
cordova-plugin-compat 1.2.0 "Compat" cordova-plugin-compat 1.2.0“兼容”
cordova-plugin-datepicker 0.9.3 "DatePicker" cordova-plugin-datepicker 0.9.3“DatePicker”
cordova-plugin-device 2.0.3 "Device" cordova-plugin-device 2.0.3“设备”
cordova-plugin-dialogs 2.0.2 "Notification" cordova-plugin-dialogs 2.0.2“通知”
cordova-plugin-file 6.0.2 "File" cordova-plugin-file 6.0.2“文件”
cordova-plugin-file-hash 0.4.1 "FileHash" cordova-plugin-file-hash 0.4.1“FileHash”
cordova-plugin-filepath 1.5.8 "cordova-plugin-filepath" cordova-plugin-filepath 1.5.8 “cordova-plugin-filepath”
cordova-plugin-geolocation 4.0.2 "Geolocation" cordova-plugin-geolocation 4.0.2“地理定位”
cordova-plugin-globalization 1.11.0 "Globalization" cordova-plugin-globalization 1.11.0 “全球化”
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser" cordova-plugin-inappbrowser 3.2.0“InAppBrowser”
cordova-plugin.network-information 2.0.2 "Network Information" cordova-plugin.network-information 2.0.2“网络信息”
cordova-plugin-sign-in-with-apple 0.1.2 "cordova-plugin-sign-in-with-apple" cordova-plugin-sign-in-with-apple 0.1.2“cordova-plugin-sign-in-with-apple”
cordova-plugin-splashscreen 5.0.3 "Splashscreen" cordova-plugin-splashscreen 5.0.3“启动画面”
cordova-plugin-statusbar 2.4.3 "StatusBar" cordova-plugin-statusbar 2.4.3“状态栏”
cordova-plugin-whitelist 1.3.4 "Whitelist" cordova-plugin-whitelist 1.3.4 “白名单”
cordova-plugin-wkwebview-engine 1.2.1 "Cordova WKWebView Engine" cordova-plugin-wkwebview-engine 1.2.1 “Cordova WKWebView 引擎”
cordova-plugin-wkwebview-file-xhr 2.1.4 "Cordova WKWebView File XHR Plugin" cordova-plugin-wkwebview-file-xhr 2.1.4 “Cordova WKWebView 文件 XHR 插件”
cordova-sqlite-storage 5.0.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version" cordova-sqlite-storage 5.0.0 《Cordova sqlite 存储插件-cordova-sqlite-storage 插件版》
ionic-plugin-keyboard 2.2.1 "Keyboard" ionic-plugin-keyboard 2.2.1“键盘”
phonegap-plugin-mobile-accessibility 1.0.5-dev "Mobile Accessibility" phonegap-plugin-mobile-accessibility 1.0.5-dev“移动辅助功能”

Try adding to you config尝试添加到您的配置

 <preference name="AndroidInsecureFileModeEnabled" value="true" />

The setting Eric suggested might work for you but it's not recommended. Eric 建议的设置可能适合您,但不推荐这样做。 The new cordova-android version uses an API called WebViewAssetLoader to load your app on a proper http(s) scheme instead of file:.新的 cordova-android 版本使用一个名为 WebViewAssetLoader 的 API 来加载您的应用程序到正确的 http(s) 方案而不是文件:。 I suspect you get CORS issues while downloading your data.我怀疑您在下载数据时遇到 CORS 问题。

Read more about the WebViewAssetLoader in Cordova: https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html在 Cordova 中阅读有关 WebViewAssetLoader 的更多信息: https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html

A better way is to figure out a proper CORS and to not use the insecure setting.更好的方法是找出一个正确的 CORS 并且不要使用不安全的设置。 You should find plenty of resources about CORS. Reply if you need help.你应该找到很多关于 CORS 的资源。如果你需要帮助,请回复。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试安装 Cordova Android 平台 9 和目标 Android ZDB97444291083CA814DZ 时出现错误“无法从平台加载 PlatformApi” - Error 'Unable to load PlatformApi from the platform' when trying to install Cordova Android Platform 9 and target Android API 29 Android API 30 构建错误,但未在 API 29 中发生 - Android API 30 build error, but was not occurred in API 29 API 27 到 29 迁移后 Android recyclerview 性能不佳 - Android recyclerview poor performance after API 27 to 29 Migration 在 Android API 29 和 API 30 中创建到 /sdcard/Download 文件夹下的文件夹 - Create to a folder under /sdcard/Download folder in Android API 29 and API 30 Android Studio “未找到 Android API 平台 30 的来源” - Android Studio “Sources for Android API Platform 30 Not Found” 在 android 10/11 (api 29/30) 下是否仍然可以破坏性地修改不属于您的文件? - Is it still possible to destructively modify files that you don't own under android 10/11 (api 29/30)? 在 AndroidManifest 中使用 requestLegacyExternalStorage = true 删除 Android API 29 和 30 上的文件时出现 RecoverableSecurityException - Getting RecoverableSecurityException while deleting file on Android API 29 and 30 with requestLegacyExternalStorage = true in AndroidManifest Android Studio 调试器不会在运行 API 29 Android 10 和 API 30 Android 11 的设备上的 Retrofit 回调断点处停止 - Android Studio debugger doesn't stop at Retrofit callback breakpoints on devices running API 29 Android 10 and API 30 Android 11 Android 通知未显示在 API 29 - Android notification not shown on API 29 通知未显示 android API 29 - Notifications not showing android API 29
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM