我有一些方法可以弄乱我的Ionic项目...有些帮助将不胜感激。
我正在尝试添加cordova-plugin-camera
,所以我正在做的是:
$ cordova plugin add cordova-plugin-camera
将返回错误:
Installing "cordova-plugin-camera" for android
Android Studio project detected
Error during processing of action! Attempting to revert...
Failed to install 'cordova-plugin-camera': CordovaError: Uh oh!
"C:\xampp\htdocs\project x\anonymous-social\platforms\android\app\src\main\res\xml\camera_provider_paths.xml" already exists!
at copyNewFile (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\lib\pluginHandlers.js:261:45)
at install (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\lib\pluginHandlers.js:51:17)
at ActionStack.process (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\ActionStack.js:56:25)
at PluginManager.doOperation (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:114:20)
at PluginManager.addPlugin (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:144:17)
at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\Api.js:247:74
at _fulfilled (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:570:49
(node:26116) UnhandledPromiseRejectionWarning: CordovaError: Uh oh!
"C:\xampp\htdocs\project x\anonymous-social\platforms\android\app\src\main\res\xml\camera_provider_paths.xml" already exists!
at copyNewFile (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\lib\pluginHandlers.js:261:45)
at install (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\lib\pluginHandlers.js:51:17)
at ActionStack.process (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\ActionStack.js:56:25)
at PluginManager.doOperation (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:114:20)
at PluginManager.addPlugin (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:144:17)
at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\Api.js:247:74
at _fulfilled (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:570:49
(node:26116) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:26116) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
由于它似乎存在,我不妨尝试将其删除:
$ cordova plugin rm cordova-plugin-camera
然后告诉我:
> cordova plugin remove cordova-plugin-camera --save
Uninstalling cordova-plugin-camera from android
Android Studio project detected
(node:18656) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'C:\xampp\htdocs\project x\anonymous-social\platforms\android\app\src\main\assets\www\cordova_plugins.js'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.writeFileSync (fs.js:1299:33)
at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\cordova-common\src\PluginManager.js:134:16
at _fulfilled (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:877:14
at runSingle (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\xampp\htdocs\project x\anonymous-social\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
(node:18656) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18656) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
目前,我认为我的Android
平台存在问题,因此我删除了该平台:
$ cordova platform remove android --save
Removing platform android from config.xml file...
Removing android from cordova.platforms array in package.json
然后将其添加回去似乎可以正常工作
--save flag or autosave detected
Saving android@~7.0.0 into config.xml file ...
有人知道会发生什么吗?我的android平台似乎有些混乱,因为其他插件在做同样的事情……有什么帮助吗?谢谢!
答案 0 :(得分:3)
几周前,我遇到了类似的问题。在几个月的时间里,我向该项目添加了插件,由于每个插件都存储有其确切的版本号,所以我最终陷入了一系列不兼容的插件版本中。 最后,我从一个空项目开始,添加了所需的所有插件,然后将源代码复制到了该项目中。 这不是一个好的解决方案,但对我来说却奏效了。
在您走得那么远之前,您
通过这种方式可以纠正“较小的混乱”。