简体   繁体   中英

No such file AndroidManifest.xml with cordova >= 7

I have an ionic project and I need to use Batch . In order to use Batch in the last version (2.0.0), I should update my cordova-android to >=7.0.0 .

But the problem is that if I update that dependency to the required version, all the other plugins fails because they not support that cordova-android version yet.

Basically, it says that AndroidManifest.xml file is not found:

(node:8420) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open '/<mypath>/platforms/android/AndroidManifest.xml'

if I do this steps:

  1. remove the android platform ( cordova platform remove android ).
  2. remove node_modules and plugins ( rm -rf /node_modules /plugins ).
  3. remove the plugins entries in the packaje.json and in config.xml .
  4. add android platform again ( cordova platform add android ).

The android platform is created. BUT, if I try to add the batch plugin I have the same error (when they said they support cordova-android >= 7 only):

ionic cordova plugin add com.batch.cordova
> cordova plugin add com.batch.cordova --save
Installing "com.batch.cordova" for android

Failed to install 'com.batch.cordova': Error: ENOENT: no such file or directory, open '/<mypath>/platforms/android/AndroidManifest.xml'

I mentioned this plugin for example because they say that they ONLY support cordova-android >= 7 but it's happening with ALL the cordova plugins in my case.

I could use a minor version of Batch plugin ( 1.7.4 ) that is compatible with older version cordova-android . But that version of Batch has not got the In app messaging feature and it's required in my case. That version only has Push notifications and events tracking :/

This is my ionic info:

cli packages: (/usr/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.10
    Cordova Platforms  : android 7.1.1
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.0.2
    Node              : v6.14.3
    npm               : 4.6.1 
    OS                : Linux 4.4

Environment Variables:

    ANDROID_HOME : /home/ivan/Android

Misc:

    backend : legacy

Any solution for this? I can't find any solution. People have this error with specific plugins but in my case it's happening with all the plugins!

Thanks!

As per the documentation, you need to use "ionic cordova plugin add yourpluginname --nofetch" to install the plugins in Cordova7. It is defined in the cordova 7 documentation. Please refer below link for more details:
https://cordova.apache.org/news/2017/05/04/cordova-7.html

It will be like this

ionic cordova plugin add com.batch.cordova --nofetch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM