zoukankan      html  css  js  c++  java
  • Cordova项目config.xml添加android权限

    最近在开发cordova项目,安卓APP需要调用照相机和系统相册,在添加安卓权限的时候,总是报错。

    以下是部分config.xml代码

    <platform name="android">
            <name>项目名称</name>
            <allow-intent href="market:*" />
            <icon density="ldpi" src="res/icon/android/icon_48.png" />
            <icon density="mdpi" src="res/icon/android/icon_48.png" />
            <icon density="hdpi" src="res/icon/android/icon_72.png" />
            <icon density="xhdpi" src="res/icon/android/icon_96.png" />
            <icon density="xxhdpi" src="res/icon/android/icon_144.png" />
            <icon density="xxxhdpi" src="res/icon/android/icon_192.png" />
            <splash density="land-hdpi" src="res/screen/android/splash-land-hdpi.png" />
            <splash density="land-ldpi" src="res/screen/android/splash-land-ldpi.png" />
            <splash density="land-mdpi" src="res/screen/android/splash-land-mdpi.png" />
            <splash density="land-xhdpi" src="res/screen/android/splash-land-xhdpi.png" />
            <splash density="land-xxhdpi" src="res/screen/android/splash-land-xxhdpi.png" />
            <splash density="port-hdpi" src="res/screen/android/splash-port-hdpi.png" />
            <splash density="port-ldpi" src="res/screen/android/splash-port-ldpi.png" />
            <splash density="port-mdpi" src="res/screen/android/splash-port-mdpi.png" />
            <splash density="port-xhdpi" src="res/screen/android/splash-port-xhdpi.png" />
            <splash density="port-xxhdpi" src="res/screen/android/splash-port-xxhdpi.png" />
            <config-file parent="/*" target="AndroidManifest.xml">
                <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
                <uses-permission android:name="android.permission.CAMERA" />
            </config-file>
        </platform>

    其中权限部分为:

    <config-file parent="/*" target="AndroidManifest.xml">
                <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
                <uses-permission android:name="android.permission.CAMERA" />
    </config-file>

    编译的时候总是报错:

    /platforms/android/build/intermediates/res/merged/debug/xml/config.xml:79: error: Error parsing XML: unbound prefix

    解决:

    在widget标签引入xmlns:android="http://schemas.android.com/apk/res/android"

    <widget id="com.demo.myapp" version="1.1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  • 相关阅读:
    spring security 获取当前用户
    spring data jpa deleteInBatch 导致异常 java.lang.StackOverflowError
    大数据 分布式文件系统 HDFS概念
    angular9 ng start正常,build部署后无法正常加载页面
    springboot使用rocketmq RocketMQMessageListener参数
    spring boot使用rocketmq
    Teamcenter RAC 调用查询
    Teamcenter RAC 查找数据集并获取数据集中文件
    带有编译时和运行时的简记
    前台线程和后台线程、线程安全
  • 原文地址:https://www.cnblogs.com/lyxy/p/6909759.html
Copyright © 2011-2022 走看看