ENOENT: no such file or directory, open 'platforms/android/AndroidManifest.xml'

Hello,

I’ve just reinstalled Ubuntu 16.04 lts, so I installed Android SDK, Node, NPM…
There is my ionic info output :

cli packages: (/home/dlazzy/.nvm/versions/node/v7.8.0/lib/node_modules)

    @ionic/cli-utils  : 1.10.2
    ionic (Ionic CLI) : 3.10.3

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.1.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v7.8.0
    npm               : 5.7.1 
    OS                : Linux 4.13

So I cloned my aleady started Ionic project, then I do npm install && ionic cordova build android, there was no problem with npm install, but when building for Android, I have this error :

Error: Uh oh!
ENOENT: no such file or directory, open '/home/dlazzy/project_dir/platforms/android/AndroidManifest.xml'

So I can’t build anymore for Android… Before resetting my computer I already have node@7.8.0, codova@7.0.1 and ionic@3.10.3 and there was no problem :frowning:
Thanks for your help

Hey@Dlazzy
Try this it may help you

ionic cordova platform add android
1 Like

Try to remove and add your platform. With the introdction of cordova 7 the file structure of the Android platform did change

ionic cordova platform rm android --save
ionic cordova platform add android@latest --save

http://cordova.apache.org/announcements/2017/12/04/cordova-android-7.0.0.html

You did clone your project, so maybe on the source project you were using cordova-android < 7

2 Likes

Hello,

My project have <engine name="android" spec="^7.0.0" /> in config.xml currently on the repository.
Also "cordova-android": "^7.1.0" in package.json.
I will try what you say by removing and adding latest android platform thanks.

I doesn’t work, you could try to use cordova-android@6.4.0 just to check if it’s the problem

Or maybe update the plugins in order to be compatible with 7.1.0

1 Like

It worked !
This is what I do :

  • Installed node@7.8.0, ionic@3.12.0 and cordova@7.0.1.
  • Removed the project folder
  • Cloned again
  • Directly in package.json set "cordova-android": "6.4.0"
  • Then npm install && ionic cordova build android and it works !

Also ionic cordova run android --prod works.

Thank you very much @reedrichards and @vibinflogesoft

5 Likes

I found one solution without downgrade cordova-android. What I did:

  • Added <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" /> in config.xml, in plugins/plugin.xml (inside platform android tag) and in all plugin.xml(inside platform android tag too) of all plugins installed.

  • And I changed
    var manifestPath = path.join(ctx.opts.projectRoot, 'platforms/android/AndroidManifest.xml');
    to var manifestPath = path.join(ctx.opts.projectRoot, 'platforms/android/app/src/main/AndroidManifest.xml');
    in plugins/updateMultidexManifest.js

It seems the project is missing cordova.js on platforms folder & while building it missing some important files , So you can run below commands for respective platforms.

Android

ionic cordova platform rm android --save
ionic cordova platform add android --save

iOS

ionic cordova platform rm ios --save
ionic cordova platform add ios --save

It should work.