AndroidAccessory.h problem with PN532.h

Hi!

I am new in using Arduino as Android Accessory so please bare with me.

I have a Mega ADK and NFC shield. I tried using the SeeedstudioLibrary for NFc Shield to read the NFC Tags and it works fine but when i tried to incorporate AndroidAccessory.h to my sketch, "Didn't find PN53x board" is being displayed in the Serial Monitor every time I tried to initialize AndroidAccessory acc.

This is the working code that works just fine in reading the NFC tags:

#include <PN532.h>

#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>

#define SCK 13
#define MOSI 11
#define SS 10
#define MISO 12

PN532 nfc(SCK, MISO, MOSI, SS);



void setup(void) {
    Serial.begin(115200);
    Serial.println("Hello!");

    nfc.begin();

    uint32_t versiondata = nfc.getFirmwareVersion();
    if (! versiondata) {
        Serial.print("Didn't find PN53x board");
        while (1); // halt
    }
    // Got ok data, print it out!
    Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
    Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
    Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
    Serial.print("Supports "); Serial.println(versiondata & 0xFF, HEX);

    // configure board to read RFID tags and cards
    nfc.SAMConfig();
}


void loop(void) {
    uint32_t id;
    // look for MiFare type cards
    id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);
    
    String hexString = String(id, HEX);
    while (hexString.length() < 8) hexString = "0" + hexString;
    
    if (id != 0) {
        Serial.println("\nRead card #"); Serial.println(id);
        Serial.println(hexString);
    }
    
    delay(1500);
}

This is the code that outputs
"Hello!
Didn't find PN53x board" :

#include <PN532.h>

#include <Max3421e.h>
#include <Usb.h>
#include <AndroidAccessory.h>

#define SCK 13
#define MOSI 11
#define SS 10
#define MISO 12

PN532 nfc(SCK, MISO, MOSI, SS);

AndroidAccessory acc("Google, Inc.",
		     "DemoKit",
		     "DemoKit Arduino Board",
		     "1.0",
		     "http://www.android.com",
		     "0000000012345678");


void setup(void) {
    Serial.begin(115200);
    Serial.println("Hello!");

    nfc.begin();

    uint32_t versiondata = nfc.getFirmwareVersion();
    if (! versiondata) {
        Serial.print("Didn't find PN53x board");
        while (1); // halt
    }
    // Got ok data, print it out!
    Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
    Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
    Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
    Serial.print("Supports "); Serial.println(versiondata & 0xFF, HEX);

    // configure board to read RFID tags and cards
    nfc.SAMConfig();
}


void loop(void) {
    uint32_t id;
    // look for MiFare type cards
    id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);
    
    String hexString = String(id, HEX);
    while (hexString.length() < 8) hexString = "0" + hexString;
    
    if (id != 0) {
        Serial.println("\nRead card #"); Serial.println(id);
        Serial.println(hexString);
    }
    
    delay(1500);
}

As you can see, I only added this to the second sketch and then the code can not find the PN53x board anymore

AndroidAccessory acc("Google, Inc.",
		     "DemoKit",
		     "DemoKit Arduino Board",
		     "1.0",
		     "http://www.android.com",
		     "0000000012345678");

I tried to check what is happening during simulation by commenting these lines

if (! versiondata) {
        Serial.print("Didn't find PN53x board");
        while (1); // halt
    }

and it seems that whenever I initialize AndroidAccessory acc, the value of the versiondata (Firmware ver.) becomes 0 when it should be 1.6 on the 1st sketch. Also the "Supports" also appeared to be 0 when it should be 7.

Any ideas why this is happening? And on how I can fix this? Thank you.