Ionic 离子生成失败“在中发现意外元素< provider>< manifest>”

dhxwm5r4  于 2023-09-28  发布在  Ionic
关注(0)|答案(6)|浏览(160)

我有这个密码

  1. <provider
  2. android:name="android.support.v4.content.FileProvider"
  3. android:authorities="nl.x-services.plugins.videocaptureplus.provider"
  4. android:exported="false"
  5. android:grantUriPermissions="true" >
  6. <meta-data
  7. android:name="android.support.FILE_PROVIDER_PATHS"
  8. android:resource="@xml/provider_paths" />
  9. </provider>

但如果我尝试“离子 cordova 运行Android”我有这个错误
https://pastebin.com/BAtL0VqK
如何处理此错误?

vpfxa7rd

vpfxa7rd1#

问题似乎是与VideoCapturePlus,因为我得到了同样的问题。我已经换成了MediaCapture,不再有这个问题了。

qgelzfjb

qgelzfjb2#

确实有一个<provider>元素错误地注入到结果AndroidManifest.xml中。
此元素来自videoCapturePlus插件的plugin.xml文件。
1.注解掉/node_modules/cordova-plugin-video-capture-plus/plugin.xml文件中的错误行

  1. <provider
  2. android:name="android.support.v4.content.FileProvider"
  3. android:authorities="nl.x-services.plugins.videocaptureplus.provider"
  4. android:exported="false"
  5. android:grantUriPermissions="true">
  6. <meta-data
  7. android:name="android.support.FILE_PROVIDER_PATHS"
  8. android:resource="@xml/provider_paths"/>
  9. </provider>

1.重新生成平台文件(android)使用命令行
ionic cordoba build androidionic capacitor build android
1.在Android Studio中重新运行Gradle构建
就是这样!

展开查看全部
9ceoxa92

9ceoxa923#

尝试从plugin/nl.x-services.plugins.videocaptureplus/plugin.xml中删除此code

7z5jn7bk

7z5jn7bk4#

我修复编辑platform/android/android.json
移动木块
step 1进入“应用程序”块step 2

xqkwcwgp

xqkwcwgp5#

这是我做的序列

  1. npx cordova platform rm android --nosave
  2. npx ionic cordova plugin rm nl.x-services.plugins.videocaptureplus
  3. npx ionic cordova plugin add https://github.com/Neocrea/cordova-plugin-video-capture-plus\#patch-1
  4. npx ionic cordova platform add android@latest

我使用了https://github.com/Neocrea/cordova-plugin-video-capture-plus#patch-1,因为它有修复这个问题的必要补丁。这不是最好的解决方案IMO,相反,你应该使用media capture插件,这是我们正在迁移的东西,但这是一个权宜之计。

jjjwad0x

jjjwad0x6#

我已经解决了这个问题,并在我的情况下在Android上完美工作,只需按照步骤:
1.在文件platforms\android\android.json
1.删除数组**“AndroidManifest.xml”中的以下代码:{“parents”:{“/manifest/application”:["/":[ ....]**
产品名称:1000 - 10000 - 10000
1.并将代码放入**“application”**数组中

然后重新构建:ionic cordoba build android(命令行)并在android studio中重新运行gradle build

相关问题