无法添加cordova-plugin-telerik-imagepicker。此插件中的 <edit-config> 更改与 config.xml 中的 <edit-config&g

Posted

技术标签:

【中文标题】无法添加cordova-plugin-telerik-imagepicker。此插件中的 <edit-config> 更改与 config.xml 中的 <edit-config> 更改冲突【英文标题】:cordova-plugin-telerik-imagepicker cannot be added. <edit-config> changes in this plugin conflicts with <edit-config> changes in config.xml 【发布时间】:2020-12-22 05:44:45 【问题描述】:

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
  xmlns:android="http://schemas.android.com/apk/res/android"
  id="cordova-plugin-telerik-imagepicker"
  version="2.2.4">

    <name>ImagePicker</name>

    <description>
        This plugin allows selection of multiple images from the camera roll / gallery in a phonegap app
    </description>

    <license>MIT</license>

    <engines>
        <engine name="cordova" version=">=3.5.0" />
    </engines>

    <js-module src="www/imagepicker.js" name="ImagePicker">
        <clobbers target="plugins.imagePicker" />
    </js-module>

    <!-- ios -->
    <platform name="ios">
        <config-file target="config.xml" parent="/*">
            <feature name="ImagePicker">
                <param name="ios-package" value="SOSPicker"/>
            </feature>
        </config-file>

        <preference name="PHOTO_LIBRARY_USAGE_DESCRIPTION" default=" " />
        <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
          <string>$PHOTO_LIBRARY_USAGE_DESCRIPTION</string>
        </config-file>

        <header-file src="src/ios/SOSPicker.h" />
        <source-file src="src/ios/SOSPicker.m" />

        <header-file src="src/ios/GMImagePicker/UIImage+fixOrientation.h" />
        <source-file src="src/ios/GMImagePicker/UIImage+fixOrientation.m" />

        <header-file src="src/ios/GMImagePicker/GMAlbumsViewCell.h" />
        <source-file src="src/ios/GMImagePicker/GMAlbumsViewCell.m" />

        <header-file src="src/ios/GMImagePicker/GMAlbumsViewController.h" />
        <source-file src="src/ios/GMImagePicker/GMAlbumsViewController.m" />

        <header-file src="src/ios/GMImagePicker/GMFetchItem.h" />
        <source-file src="src/ios/GMImagePicker/GMFetchItem.m" />

        <header-file src="src/ios/GMImagePicker/GMGridViewCell.h" />
        <source-file src="src/ios/GMImagePicker/GMGridViewCell.m" />

        <header-file src="src/ios/GMImagePicker/GMGridViewController.h" />
        <source-file src="src/ios/GMImagePicker/GMGridViewController.m" />

        <header-file src="src/ios/GMImagePicker/GMImagePickerController.h" />
        <source-file src="src/ios/GMImagePicker/GMImagePickerController.m" />

        <header-file src="src/ios/GMImagePicker/PSYBlockTimer.h" />
        <source-file src="src/ios/GMImagePicker/PSYBlockTimer.m" />

        <header-file src="src/ios/GMImagePicker/GMPHAsset.h" />
        <source-file src="src/ios/GMImagePicker/GMPHAsset.m" />

        <resource-file src="src/ios/GMImagePicker/GMEmptyFolder@1x.png" />
        <resource-file src="src/ios/GMImagePicker/GMEmptyFolder@2x.png" />

        <resource-file src="src/ios/GMImagePicker/GMSelected.png" />
        <resource-file src="src/ios/GMImagePicker/GMSelected@2x.png" />

        <resource-file src="src/ios/GMImagePicker/GMVideoIcon.png" />
        <resource-file src="src/ios/GMImagePicker/GMVideoIcon@2x.png" />

        <resource-file src="src/ios/GMImagePicker/ca.lproj" />
        <resource-file src="src/ios/GMImagePicker/de.lproj" />
        <resource-file src="src/ios/GMImagePicker/en.lproj" />
        <resource-file src="src/ios/GMImagePicker/es.lproj" />
        <resource-file src="src/ios/GMImagePicker/fr.lproj" />
        <resource-file src="src/ios/GMImagePicker/it.lproj" />
        <resource-file src="src/ios/GMImagePicker/pt.lproj" />
        <resource-file src="src/ios/GMImagePicker/pl.lproj" />
        <resource-file src="src/ios/GMImagePicker/zh-Hans.lproj" />

        <framework src="Accelerate.framework" />
        <framework src="Security.framework" />
        <framework src="Photos.framework" />
        <framework src="SystemConfiguration.framework" />
        <framework src="QuartzCore.framework" />

    </platform>

    <!-- android -->
    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="ImagePicker">
                <param name="android-package" value="com.synconset.ImagePicker"/>
            </feature>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/manifest/application">
            <activity android:label="@string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity" android:theme="@style/Theme.AppCompat.Light">
            </activity>
        </config-file>

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

        <framework src="com.android.support:appcompat-v7:23+" />

        <source-file src="src/android/com/synconset/ImagePicker/ImagePicker.java" target-dir="src/com/synconset" />
        <source-file src="src/android/com/synconset/ImagePicker/FakeR.java" target-dir="src/com/synconset" />

        <source-file src="src/android/Library/src/ImageFetcher.java" target-dir="src/com/synconset"/>
        <source-file src="src/android/Library/src/MultiImageChooserActivity.java" target-dir="src/com/synconset"/>

        <resource-file src="src/android/Library/res/anim/image_pop_in.xml" target="res/anim/image_pop_in.xml"/>
        <resource-file src="src/android/Library/res/drawable/grid_background.xml" target="res/drawable/grid_background.xml"/>
        <resource-file src="src/android/Library/res/drawable-hdpi/image_bg.9.png" target="res/drawable-hdpi/image_bg.9.png"/>
        <resource-file src="src/android/Library/res/drawable-hdpi/loading_icon.png" target="res/drawable-hdpi/loading_icon.png"/>
        <resource-file src="src/android/Library/res/drawable-mdpi/ic_action_discard_dark.png" target="res/drawable-mdpi/ic_action_discard_dark.png"/>
        <resource-file src="src/android/Library/res/drawable-mdpi/ic_action_discard_light.png" target="res/drawable-mdpi/ic_action_discard_light.png"/>
        <resource-file src="src/android/Library/res/drawable-mdpi/ic_action_done_dark.png" target="res/drawable-mdpi/ic_action_done_dark.png"/>
        <resource-file src="src/android/Library/res/drawable-mdpi/ic_action_done_light.png" target="res/drawable-mdpi/ic_action_done_light.png"/>
        <resource-file src="src/android/Library/res/drawable-mdpi/ic_launcher.png" target="res/drawable-mdpi/ic_launcher.png"/>
        <resource-file src="src/android/Library/res/drawable-xhdpi/ic_action_discard_dark.png" target="res/drawable-xhdpi/ic_action_discard_dark.png"/>
        <resource-file src="src/android/Library/res/drawable-xhdpi/ic_action_discard_light.png" target="res/drawable-xhdpi/ic_action_discard_light.png"/>
        <resource-file src="src/android/Library/res/drawable-xhdpi/ic_action_done_dark.png" target="res/drawable-xhdpi/ic_action_done_dark.png"/>
        <resource-file src="src/android/Library/res/drawable-xhdpi/ic_action_done_light.png" target="res/drawable-xhdpi/ic_action_done_light.png"/>
        <resource-file src="src/android/Library/res/drawable-xhdpi/ic_launcher.png" target="res/drawable-xhdpi/ic_launcher.png"/>
        <resource-file src="src/android/Library/res/layout/actionbar_custom_view_done_discard.xml" target="res/layout/actionbar_custom_view_done_discard.xml"/>
        <resource-file src="src/android/Library/res/layout/actionbar_discard_button.xml" target="res/layout/actionbar_discard_button.xml"/>
        <resource-file src="src/android/Library/res/layout/actionbar_done_button.xml" target="res/layout/actionbar_done_button.xml"/>
        <resource-file src="src/android/Library/res/layout/multiselectorgrid.xml" target="res/layout/multiselectorgrid.xml"/>
        <resource-file src="src/android/Library/res/values/multiimagechooser_strings_en.xml" target="res/values/multiimagechooser_strings_en.xml"/>
        <resource-file src="src/android/Library/res/values/themes.xml" target="res/values/themes.xml"/>

        <resource-file src="src/android/Library/res/values-de/multiimagechooser_strings_de.xml" target="res/values-de/multiimagechooser_strings_de.xml"/>
        <resource-file src="src/android/Library/res/values-es/multiimagechooser_strings_es.xml" target="res/values-es/multiimagechooser_strings_es.xml"/>
        <resource-file src="src/android/Library/res/values-fr/multiimagechooser_strings_fr.xml" target="res/values-fr/multiimagechooser_strings_fr.xml"/>
        <resource-file src="src/android/Library/res/values-hu/multiimagechooser_strings_hu.xml" target="res/values-hu/multiimagechooser_strings_hu.xml"/>
        <resource-file src="src/android/Library/res/values-ja/multiimagechooser_strings_ja.xml" target="res/values-ja/multiimagechooser_strings_ja.xml"/>
        <resource-file src="src/android/Library/res/values-ko/multiimagechooser_strings_ko.xml" target="res/values-ko/multiimagechooser_strings_ko.xml"/>
        <source-file src="src/android/Library/res/values-pl/multiimagechooser_strings_pl.xml" target-dir="res/values-pl"/>

        <framework src="src/android/ignorelinterrors.gradle" custom="true" type="gradleReference"/>
        <framework src="src/android/androidtarget.gradle" custom="true" type="gradleReference"/>
    </platform>
</plugin>

图像选择器最初可以工作,但突然间我收到以下错误:

“尝试调用ImagePicker.hasReadPermission,但没有安装ImagePicker插件”

我尝试卸载并重新安装图像选择器无济于事,我不确定到底发生了什么。

    "cordova-plugin-telerik-imagepicker": "^2.3.5",

任何帮助将不胜感激

ionic cordova -v
6.0.1

9.0.0 (cordova-lib@9.0.1)

    "cordova-android": "^8.1.0",
    "cordova-ios": "^5.1.1",

无法添加cordova-plugin-telerik-imagepicker。此插件中的更改与 config.xml 中的更改冲突

【问题讨论】:

你能试试cordova plugin add https://github.com/Anuj-logiciel/ImagePicker.git 并确认它是否适合你吗?另请检查 Android 10 是否允许选择图像。 【参考方案1】:

此错误的当前解决方法是: 现在安装 plugin version 2.3.3,直到 Telerik 团队解决问题并手动更新 config.xml 文件中的以下配置。

<platform name="android">
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
        <application android:networkSecurityConfig="@xml/network_security_config" />
        <application android:requestLegacyExternalStorage="true" />
    </edit-config>
</platform>

他们在 config.xml 中添加了&lt;application android:requestLegacyExternalStorage="true" /&gt; 以支持 android 10 设备中的图像选择器。

【讨论】:

具有讽刺意味的是,我们运行的是 2.3.3 并更新到 2.3.5,希望它能解决 Android 10 的问题!我们已经回滚到 2.3.3 并将 android:requestLegacyExternalStorage 添加到我们的配置中,它运行良好,谢谢!

以上是关于无法添加cordova-plugin-telerik-imagepicker。此插件中的 <edit-config> 更改与 config.xml 中的 <edit-config&g的主要内容,如果未能解决你的问题,请参考以下文章

火狐无法添加书签 无法保存历史

无法将组件添加到扩展 JFrame 的类

无法添加圆角半径和阴影

为 UIView 添加时,UITapGestureRecognizer 无法正常工作无法检测到问题

无法将 ReactiveUI 添加到 NUnit 测试项目

向添加到 UIWindow 的视图添加约束时,为啥无法设置自动布局约束?