Library AFMotor.h and IRLib.h do not work together

I use a clone of the motor shield v1 from adafruit and have connected a ir-diode on its d2 pin.

I can sucessfully use the motorshield with a led connected to output 1 using this sketch

#include <AFMotor.h>
#include <IRLib.h>
AF_DCMotor motor(1, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

IRrecv My_Receiver(2); // d2
IRdecode My_Decoder;

void setup()
{
   Serial.begin(9600);
  //  My_Receiver.enableIRIn();
}

void loop() {
    motor.setSpeed(40); 
    motor.run(FORWARD);  
    delay(500);
}

But as soon as I comment in the line My_Receiver.enableIRIn(); the led is not lit anymore.

Also if I use this sketch to output the values from the ir-diode it is working, but a soon as I include the motorlibary and call motor.setSpeed(20) I cant see the values from the ir remote in the serial monitor anymore.

#include <IRLib.h>
#include <AFMotor.h>

IRrecv My_Receiver(2); // d2
IRdecode My_Decoder;

AF_DCMotor motor(1, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

void setup()
{
  Serial.begin(9600);
  My_Receiver.enableIRIn();
}

void loop() {
  
  if (My_Receiver.GetResults(&My_Decoder)) {
    My_Decoder.decode();    //Decode the data
  Serial.println(My_Decoder.value, HEX);

     //motor.setSpeed(20); 

    My_Receiver.resume();     //Restart the receiver
  }
}

Is this a known isue? Any ideas to debug this further?

Just try to use other PINs. For instance A0-A5 are not used by AF_Motor

AF_Motor and IRLib are incompatible on default settings (at least on '328p based boards) - they both use timer2.

Assuming you're using something based on a '328p (Uno, duemillanove, pro mini, etc):
Comment out line 96 in IRLibTimer.h, and uncomment line 95 - this tells it to use timer1 instead of timer2. Output will move from pin 3 to pin 9 if I'm reading it correctly.

Be aware that that's apparently a library for an old version of the adafruit motor shield, and there's a new version of IRLib too.