Unable to install cordova-facebook-4 plugin with android 7.0.0

NEED HELPPPPP!!!

Failed to install ‘cordova-plugin-facebook4’: Error: ENOENT: no such file or directory, open '/Applications/XAMPP/xamppfiles/htdocs/<app_name>/platforms/android/AndroidManifest.xml’
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
at Object.parseElementtreeSync (/Applications/XAMPP/xamppfiles/htdocs/ratnasangh/platforms/android/cordova/node_modules/cordova-common/src/util/xml-helpers.js:180:27)
at new AndroidManifest (/Applications/XAMPP/xamppfiles/htdocs/ratnasangh/platforms/android/cordova/lib/AndroidManifest.js:29:20)
at AndroidProject.getPackageName (/Applications/XAMPP/xamppfiles/htdocs/ratnasangh/platforms/android/cordova/lib/AndroidProject.js:99:12)
at Api.addPlugin (/Applications/XAMPP/xamppfiles/htdocs/<app_name>/platforms/android/cordova/Api.js:223:57)
at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:594:10)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
(node:7823) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open ‘/Applications/XAMPP/xamppfiles/htdocs/<app_name>/platforms/android/AndroidManifest.xml’

Have you checked that path to verify that the file in question indeed does not exist?

'/Applications/XAMPP/xamppfiles/htdocs/<app_name>/platforms/android/AndroidManifest.xml’

Try removing your Android platform and adding it again. I recently installed this plugin (yesterday) using 7.0.0 and all is well.

cordova-facebook-4 isn’t yet compatible with cordova-android >= 7

  1. you have to use cordova-android 6.4.0
    or
  2. or have a look at the following issue https://github.com/jeduan/cordova-plugin-facebook4/issues/599, someone posted a workaround (which I didn’t try)

Abd that you should not have recommended to anyone. :frowning: Who goes for the older technologies?

Do what you want, these are the current solutions

1 Like

For the record, the workaround described in the issue I linked seems to just works fine

Respectively @ChrisHSandN commented like the following:

As a temporary fix which doesn’t need manual editing of any platform specific files:

Add to config.xml

<platform name="android">
    <config-file parent="/resources" target="./res/values/strings.xml">
        <string name="fb_app_id">1234</string>
        <string name="fb_app_name">foobar</string>
    </config-file>
    ...

Reedrichards,
I followed this tutorial (http://tech.tribalyte.eu/blog-autenticacion-nativa-con-facebook-en-ionic-3-x/comment-page-1#comment-210) in order to be able to log in an out from facebook with diferent accounts (mine and test users from faceboook).

To be able to log in i have gone to the issue you present, and i have also added what @ChrisHSandN commented on the config.xml.

It Did worked for me, but i am not able to log out and log in into a diferent account, the app keeps stoping. i can only go into 1 user, if i log out and try to log in again, it automaticly stops and i haven’t got any idea why…

iOS and Android?

could you provide a sample repo?

could you provide stacktrace or/and maybe a video record ?

P.S.: For the record I guess your question is linked with the current opening issue https://github.com/jeduan/cordova-plugin-facebook4/issues/568 - same there, without the above information we just go nowhere

reedrichards, Sorry for the uncompleted question, here comes all the deatils:

It is on Android for now.

this is a sample repo (https://github.com/Jricci1/demo), using @ChrisHSandN temporary fix, and it is attached to a facebook app called Owl that we created only for this porpuse, you could attach it to your own if ti throws you a key hash error.

i don’t know yet how t send you a stacktrace, but here goes a video record, the app automaticly sends you to jdlcarrera

facebook because it is loged in on my cel phone already, but it crashes the second time i try to log in into a different account.

Awesome, finally someone who took the time to submit a sample repo, thx a lot @@JoaquinR :thumbsup:

I was able to reproduce the problem and to fix it in the cordova-plugin-facebook4 plugin itself

This patch version v2.0.1 is now released in npm

Update your gear, it will solve your issue

Thanks to you for fixing the problem! it works perfect in another sample, no idea what was the problem, but it works now.

If it’s not to much trouble, what was the problem?

Thanks again, i wasted to much time trying to solve it by myself.

Thx for the feedback, no worries, my pleasure, glad to hear it helps :+1:

The problem was that the graph context result wasn’t reseted and was then still containing results from the previous login respectively other account. Ensuring a clean value before doing a new login solve the issue. See commit https://github.com/jeduan/cordova-plugin-facebook4/commit/b594d3259af766a00fbc98304d31101044e3bb50