当我尝试将android平台添加到我的离子项目时,我收到以下错误。这是一个现有的项目,我正在更新使用的cordova版本,我尝试了各种版本的android cordova,所有这些都是完全相同的问题,我在网上找不到任何东西,除了与黑莓相关的东西,我有删除并重新添加平台几次但没有成功,继续得到同样的错误:
> cordova platform add android@7.1.0 --save
Running command: cmd "/s /c ""C:\PROGRAM FILES\NODEJS\NODE.EXE" "E:\Development\StrikeMedia BitBucket\SpurHybridAppVersion2\hooks\before_platform_add\init_directories.js" "E:\Development\StrikeMedia BitBucket\SpurHybridAppVersion2"""
Using cordova-fetch for cordova-android@7.1.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.gloo.familycard
Name: Spur
Activity: MainActivity
Android target: android-27
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@7.1.0
Android Studio project detected
Android Studio project detected
(node:23852) UnhandledPromiseRejectionWarning: Error: Unable to graft xml at selector "undefined" from "E:\Development\StrikeMedia BitBucket\SpurHybridAppVersion2\platforms\android\app\src\main\AndroidManifest.xml" during config install
at ConfigFile_graft_child [as graft_child] (C:\Users\Armand van der Walt\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigFile.js:122:19)
at PlatformMunger_apply_file_munge [as apply_file_munge] (C:\Users\Armand van der Walt\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:81:34)
at munge_helper (C:\Users\Armand van der Walt\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:238:14)
at PlatformMunger.add_config_changes (C:\Users\Armand van der Walt\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:216:12)
at C:\Users\Armand van der Walt\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:130:32
at _fulfilled (E:\Development\StrikeMedia BitBucket\SpurHybridAppVersion2\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (E:\Development\StrikeMedia BitBucket\SpurHybridAppVersion2\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (E:\Development\StrikeMedia BitBucket\SpurHybridAppVersion2\platforms\android\cordova\node_modules\q\q.js:816:13)
at E:\Development\StrikeMedia BitBucket\SpurHybridAppVersion2\platforms\android\cordova\node_modules\q\q.js:624:44
at runSingle (E:\Development\StrikeMedia BitBucket\SpurHybridAppVersion2\platforms\android\cordova\node_modules\q\q.js:137:13)
(node:23852) 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:23852) [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.
到目前为止我尝试过的命令
ionic cordova platform add android@7.1.0
ionic cordova platform add android@6.4.0
ionic cordova platform add android@latest
ionic cordova platform add android
离子信息
[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying .\bower.json.
cli packages: (C:\Users\Armand van der Walt\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
Cordova Platforms : android 7.1.0
Ionic Framework : ionic1 1.2.4
System:
Android SDK Tools : 26.1.1
Node : v9.4.0
npm : 5.6.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : E:\Android\sdk
Misc:
backend : pro
答案 0 :(得分:0)
最后,我必须卸载cordova和ionic,从项目中删除平台,然后重新安装所有内容并重新添加平台以使其再次正常工作。