Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Including FirebaseArduino and ArduinoJson causes redefinition errors #246

Closed
ChrisAlphabet opened this issue Jan 30, 2017 · 15 comments
Closed

Comments

@ChrisAlphabet
Copy link

Hi all,

I am working on a project that uses both FirebaseArduino and ArduinoJson libraries.

When I try to include ArduinoJson.h I get the the error that it has already been included in \path-to-libs\firebase-arduino\src\third-party\arduino-json-5.3\include\ArduinoJson\etc

Is there a nice way to use these two libraries together? At the moment I am including FirebaseArduino.h where I need to use ArduinoJson.h which is not a particularly nice solution.

Thanks!

@jason7sc
Copy link

jason7sc commented Mar 30, 2017

FirebaseArduino includes support for ArduinoJson. Simply include FirebaseArduino and create JSON data following the encoding procedure explained in the ArduinoJson documentation.

@andreantivilo
Copy link

andreantivilo commented Jan 28, 2018

@jason7sc you saved me. I was also adding ArduinoJson.h in the code.
I do not use the official lib, just Firebase library.
Now everything works fine: Firebase, ArduinoJson, ESP8266, NodeMCU.

@shubham-kulkarni
Copy link

shubham-kulkarni commented Feb 20, 2018

Hello, i am using nodemcu and firebase for my project.
i have downloaded Arduino-Firebase Master library from GitHub. it gets included but i get -> "
C\users\PC\Documents\Arduino\libraries\firebase-arduino-master\src/Firebase.h:26:25: fatal error: ArduinoJson.h: No such file or directory
#include <ArduinoJson.h> " this error.

i tried only ->

#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
void setup() {}
void loop() {}

this code. i have problems including the <FirebaseArduino.h> library

i tried inclding ArduinoJson library seperately. also tried it on win 7, win 8.1, and win 10.
also tried Arduino ide 1.6.7, 1.6.9 and 1.6.12
@andreantivilo as you said, "I do not use the official lib, just Firebase library." , i didn't get it.
@jason7sc @andreantivilo
will you plz help me i am unable to resolve my issue.

@kotl
Copy link
Collaborator

kotl commented Feb 20, 2018

Same as #314

Please download latest stable ArduinoJson from library manager.

@kotl
Copy link
Collaborator

kotl commented Feb 20, 2018

Starting with #296 ArduinoJson is no longer included in Firebase-arduino, you should choose your own version of ArduinoJson, as stated in main README: https://github.com/firebase/firebase-arduino

@shubham-kulkarni
Copy link

@kotl thank you. Looks like ArduinoJson library that I was using previously, was the problem.
I used ArduinoJson library from https://github.com/bblanchon/ArduinoJson as you suggested. It worked. Thank You So Much!

@proppy
Copy link
Contributor

proppy commented Jun 15, 2018

Marking this as fixed now that ArduinoJson dependencies is documented.

@proppy proppy closed this as completed Jun 15, 2018
@microflorin
Copy link

Hello all,
I'm traing to connect ESP8266 E12 with Firebase but doesn't work. I updated the library and still doesn't work. The code is ESP8266 Demo.

#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

#define FIREBASE_HOST "testflorinm.firebaseio.com"

I must include something else? The response in serial monitor is this one:
setting /number failed:
setting /number failed:

Can someone help me with this?

@andreantivilo
Copy link

// Firebase data
#define FIREBASE_HOST "XXXX.firebaseio.com"
#define FIREBASE_AUTH "YOUR-AUTH-TOKEN"

@microflorin
Copy link

#define FIREBASE_HOST "XXXX.firebaseio.com"
#define FIREBASE_AUTH "YOUR-AUTH-TOKEN"

are defined but the answer from firebase is the same.

@proppy
Copy link
Contributor

proppy commented Jun 27, 2018

@microflorin this seems similar to #357 can you provide more details about the failure and comment there?

For example try to turn-on HTTP debugging:
http://arduino-esp8266.readthedocs.io/en/latest/Troubleshooting/debugging.html

@mase12
Copy link

mase12 commented Aug 8, 2018

Hello all,
help me please. i'am beginer

how to solve this problem in nodemcu esp8266 to firebase:

C:\Users\poex\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseObject.cpp: In constructor 'FirebaseObject::FirebaseObject(const char*)':
C:\Users\poex\Documents\Arduino\libraries\firebase-arduino-master\src\FirebaseObject.cpp:23:26: error: 'class ArduinoJson::StaticJsonBuffer<1032u>' has no member named 'parse'

json_ = buffer_.get()->parse(&data_[0]);

                      ^

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

thank you

@haseeAmarathunga
Copy link

Remove your previous ArduinoJson library and Include your ArduinoJson library to this https://github.com/bblanchon/ArduinoJson . It will work!

@iramtaher
Copy link

hi, i am a new coder and working on a project on NodeMCU on arduino IDE to work with firebase. I have followed a youtube tutorial exactly the way they did it and have included ArduinoJson library (ver 5.13.1) and ArduinoFirebase library but i am getting error compiling my ESP8266, with some very long error messages. My code is as below. If i exclude the Json library, it compiles and connects to internet but fails to send the data to firebase. However, when i include the Json library i get error compiling. Can someone please help me regarding this

`#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#include <ESP8266HTTPClient.h>

#define FIREBASE_HOST "https://try-to-send-data.firebaseio.com/"
#define FIREBASE_AUTH "ujYlWZOntaPh1maEARcW0L7x9w2B9Rk6YXUIXwJq"

long randNumber;

void setup() {

Serial.begin(9600);
delay(500);
WiFi.begin("S4LINK3", "mywifipassword");
Serial.println("");
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(2000);
}
Serial.println("");
Serial.print("Successfully connected to : ");
Serial.print("S4LINK3");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
Serial.println();
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}

void loop() {
randNumber = random(100, 1000);
String dataSend = String(randNumber);
Serial.print("Random Number : ");
Serial.println(dataSend);
Firebase.setString("RandomVal/Value",String(dataSend));
if (Firebase.failed()) {
Serial.print("Setting /Value failed :");
Serial.println(Firebase.error());
delay(500);
return;
}
Serial.println("Setting successful");
Serial.println();

}`

@Shidqinfl
Copy link

hi, i am a new coder and working on a project on NodeMCU on arduino IDE to work with firebase. I have followed a youtube tutorial exactly the way they did it and have included ArduinoJson library (ver 5.13.1) and ArduinoFirebase library but i am getting error compiling my ESP8266, with some very long error messages. My code is as below. If i exclude the Json library, it compiles and connects to internet but fails to send the data to firebase. However, when i include the Json library i get error compiling. Can someone please help me regarding this

i just erase this library #include <ArduinoJson.h> and my arduino ide can compile properly
but i got new trouble, my prject esp8266 can't send data to firebase and my firebase doesnt update the data from esp8266

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests