Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is not compatible with Cordova 8.0.0 #99

Closed
gbgelado opened this issue Jan 18, 2018 · 12 comments
Closed

Is not compatible with Cordova 8.0.0 #99

gbgelado opened this issue Jan 18, 2018 · 12 comments
Labels
awaiting feedback not a bug Was submitted as an bug but was something else

Comments

@gbgelado
Copy link

Installing "cordova-plugin-app-version" for android
Failed to install 'cordova-plugin-app-version': Error: ENOENT: no such file or directory, open '/app/cordova/platforms/android/AndroidManifest.xml'
    at Object.fs.openSync (fs.js:663:18)
    at Object.fs.readFileSync (fs.js:568:33)
    at Object.parseElementtreeSync (/app/cordova/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
    at new AndroidManifest (/app/cordova/platforms/android/cordova/lib/AndroidManifest.js:29:20)
    at AndroidProject.getPackageName (/app/cordova/platforms/android/cordova/lib/AndroidProject.js:99:12)
    at Api.addPlugin (/app/cordova/platforms/android/cordova/Api.js:223:57)
    at handleInstall (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:594:10)
    at /app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28
    at _fulfilled (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
(node:68912) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/app/cordova/platforms/android/AndroidManifest.xml'
    at Object.fs.openSync (fs.js:663:18)
    at Object.fs.readFileSync (fs.js:568:33)
    at Object.parseElementtreeSync (/app/cordova/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
    at new AndroidManifest (/app/cordova/platforms/android/cordova/lib/AndroidManifest.js:29:20)
    at AndroidProject.getPackageName (/app/cordova/platforms/android/cordova/lib/AndroidProject.js:99:12)
    at Api.addPlugin (/app/cordova/platforms/android/cordova/Api.js:223:57)
    at handleInstall (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:594:10)
    at /app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28
    at _fulfilled (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/app/.npm-packages/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
@Drarok
Copy link
Contributor

Drarok commented Jan 19, 2018

MyApp $ cordova --version
8.0.0
MyApp $ cordova plugin add cordova-plugin-app-version
Installing "cordova-plugin-app-version" for android
Android Studio project detected
Adding cordova-plugin-app-version to package.json
Saved plugin info for "cordova-plugin-app-version" to config.xml
  • What commands did you run to get this error?
  • What version of Node.js are you using?

@l0stpenguin
Copy link

Hi, im am upgrading my project from cordova 6.5.0 to 8.0.0. When installing i get the following error:

Installing "cordova-plugin-app-version" for android
Failed to install 'cordova-plugin-app-version': Error: ENOENT: no such file or directory, open '/home/travis/build/SharinPix/sharinpix-app/platforms/android/AndroidManifest.xml'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at Object.parseElementtreeSync (/home/travis/build/SharinPix/sharinpix-app/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
    at new AndroidManifest (/home/travis/build/SharinPix/sharinpix-app/platforms/android/cordova/lib/AndroidManifest.js:29:20)
    at AndroidProject.getPackageName (/home/travis/build/SharinPix/sharinpix-app/platforms/android/cordova/lib/AndroidProject.js:99:12)
    at Api.addPlugin (/home/travis/build/SharinPix/sharinpix-app/platforms/android/cordova/Api.js:223:57)
    at handleInstall (/home/travis/.nvm/versions/node/v8.9.4/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:594:10)
    at /home/travis/.nvm/versions/node/v8.9.4/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28
    at _fulfilled (/home/travis/.nvm/versions/node/v8.9.4/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/home/travis/.nvm/versions/node/v8.9.4/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
Failed to restore plugin "cordova-plugin-app-version" from config.xml. You might need to try adding it again. Error: Error: ENOENT: no such file or directory, open '/home/travis/build/SharinPix/sharinpix-app/platforms/android/AndroidManifest.xml'

Nodejs version: 8.9.4

I have this in my config.xml

<plugin name="cordova-plugin-app-version" spec="^0.1.9" />

As from cordova v7, there was a breaking change which may be the root of this issue:
https://cordova.apache.org/announcements/2017/12/04/cordova-android-7.0.0.html
The path of the android manifest has changed, but since you are not referring the manifest in your plugin, i don't see why it is not working.

@znegva
Copy link

znegva commented Jan 22, 2018

This is not a problem in cordova-plugin-app-version and not Cordova 8.0.0 in general, but with cordova-android 7.0.0.
The main problem can be found in platforms/android/cordova/lib/AndroidStudio.js, see here.
There the check if your project is an AndroidStudio-project (which it is) fails and therefore the wrong path to the AndroidManifest.xml is chosen.

In my case the presence of a res directory fooled the function to think I am using eclipse and therefore using the wrong path to the manifest-file.

Check if there exists any of these files or directories inside your platform/android: ['AndroidManifest.xml', 'libs', 'res']
If so, find out which of your other plugins creates it.


In my case I had the following in my config.xml:
<resource-file src="model/icon_push.png" target="res/drawable/icon_push.png" />
So I was the cause of the problem :)

@Firzenizer
Copy link

Firzenizer commented Feb 6, 2018

I had the same issues as @znegva, but the problem has to do with this plugin and any other relying on old manifest location AFAIK.

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

aharbick added a commit to bidwrangler/bidwrangler-opentok-plugin that referenced this issue Mar 29, 2018
@joeljeske
Copy link

I have found success overriding the bad function using a hook:

https://gist.github.com/joeljeske/68121fa6d643e0937f50458d0172e16e

@dtmp
Copy link

dtmp commented Apr 11, 2018

@joeljeske thanks. added a bit: https://stackoverflow.com/a/49770295/4384751

@fishgrind
Copy link

just to let you know, cordova has a fix for it too.

add this to your config.xml:

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" />

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

just tested it and it works!

@m-thompson-code
Copy link

Adding <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" /> did nothing for me. Using the above hook did.

@fishgrind
Copy link

@moomoomamoo hmm strange, solved it for me. But I guess if the hook works, why not use that :)

@DennisSmolek DennisSmolek added the not a bug Was submitted as an bug but was something else label Jun 27, 2018
@DennisSmolek
Copy link

From the above thread it seems this is an issue with the projects config.xml/plugins.xml and not with the code in the plugin.

I'm going to close this for now unless more feedback comes up

@AlexPashley
Copy link

I've just tried this with phonegap build, v8.0.0 and it doesnt work, I cant use hooks either because pgb doesnt allow/support these.

Any other ideas?

Im trying to an image into the res folder so its available for phonegap-plugin-push

@postersw
Copy link

postersw commented Sep 8, 2018

If you are using PhoneGap build V 8.0.0, you need to change the path on your resource file copies.
If you copied a file into 'res/' under PGB v 7.x.x, you now need to copy it into 'app/src/main/res/'.
For example: '<resource-file src="push.png" target="app/src/main/res/push.png" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback not a bug Was submitted as an bug but was something else
Projects
None yet
Development

No branches or pull requests