Ionic 3和Android SDK 33 -打开相机不工作

wd2eg0qa  于 2023-11-15  发布在  Ionic
关注(0)|答案(1)|浏览(146)

我有一个应用程序,使用离子版本3和 cordova 打开相机。
然而,Google Play商店要求我将android-tagetSdkVersion从31更新到33。结果,相机打开功能在较新的设备上停止工作(如Android 11和12)。
在Android Studio的Logcat中,每当触发相机按钮时都会显示以下错误:

2023-09-19 15:35:05.799 1043-1043/? E/[email protected]: Unknown params
2023-09-19 15:35:05.800 1043-1043/? E/[email protected]: Unknown params
2023-09-19 15:35:05.805 1043-1043/? E/[email protected]: Unknown params
2023-09-19 15:35:05.805 1043-1078/? E/ANDR-PERF-LM: MetaMeter: handleAsync() 164: AdaptLaunch Invalid Async
2023-09-19 15:35:05.849 1043-1043/? E/[email protected]: Unknown params
2023-09-19 15:35:05.989 7199-7199/? E/NextAppCoreTrainingJobService: No trained model yet

字符串
在研究这个问题时,我发现有些人提到我需要更新到cordova-android版本12,因为早期版本不再支持相机。

所以我设法更新cordova-android到12.但问题仍然存在.相机打不开,不显示任何消息.
我不知道下一步该怎么做。有没有人有解决这个问题的办法?

我的包json:

{
    "name": "app",
    "version": "0.0.18",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build --prod",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.4.7",
        "@angular/compiler": "4.4.7",
        "@angular/compiler-cli": "4.4.7",
        "@angular/core": "4.4.7",
        "@angular/forms": "4.4.7",
        "@angular/http": "4.4.7",
        "@angular/platform-browser": "4.4.7",
        "@angular/platform-browser-dynamic": "4.4.7",
        "@ionic-native/app-version": "^4.20.0",
        "@ionic-native/camera": "^4.5.2",
        "@ionic-native/core": "^4.11.0",
        "@ionic-native/date-picker": "^4.20.0",
        "@ionic-native/geolocation": "^4.20.0",
        "@ionic-native/splash-screen": "4.3.2",
        "@ionic-native/status-bar": "4.3.2",
        "@ionic-native/vibration": "^4.20.0",
        "@ionic/app-scripts": "^3.2.4",
        "@ionic/storage": "2.0.1",
        "brmasker-ionic-3": "^1.6.3",
        "cordova-android": "^12.0.0",
        "cordova-custom-config": "^5.1.1",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-app-version": "^0.1.14",
        "cordova-plugin-camera": "6.0.0",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-datepicker": "^0.9.3",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-geolocation": "~2.4.3",
        "cordova-plugin-ionic-webview": "^1.1.16",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-vibration": "^2.1.6",
        "cordova-plugin-whitelist": "^1.3.1",
        "dateformat": "^5.0.3",
        "ion": "^1.0.1",
        "ionic-angular": "3.9.2",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "node-gyp": "^9.4.0",
        "rxjs": "^5.5.11",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "node-sass": "7.0.3",
        "typescript": "2.3.4"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-vibration": {},
            "cordova-plugin-datepicker": {},
            "cordova-plugin-device": {},
            "cordova-plugin-ionic-webview": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-geolocation": {
                "GEOLOCATION_USAGE_DESCRIPTION": " "
            },
            "cordova-plugin-camera": {},
            "cordova-plugin-compat": {},
            "cordova-custom-config": {},
            "cordova-plugin-app-version": {}
        },
        "platforms": [
            "android"
        ]
    }
}

离子信息:

Ionic:

   ionic (Ionic CLI)  : 4.0.0-rc.13 (C:\Users\User\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.4

Cordova:

   cordova (Cordova CLI) : 7.0.1
   Cordova Platforms     : android broken

System:

   Android SDK Tools : 26.1.1
   NodeJS            : v17.9.1 (C:\Program Files\nodejs\node.exe)
   npm               : 8.11.0
   OS                : Windows 10

4bbkushb

4bbkushb1#

您可以尝试使用更新的插件cordova-plugin-camera 7.0,该插件已于2023-09-12发布。
我更新了一个使用Ionic 3的应用程序,它工作正常,包括当源是照片库时。

相关问题