Meghan Trainor has Jennifer Lopez's back!
Luke, whose real name is Lukasz Gottwald, has been involved in an ongoing legal battle
, who accused the former of drugging and raping her. Dr. Luke has called Kesha's claims "outright lies."
Although Dr. Luke was not involved in the final version of "Ain't Your Mama," he did contribute to an early recording of the song.
"[It was] not fair on her, not at all," Trainor said of the backlash received by Lopez, speaking with OfficialCharts.com.
"I texted her the song and she had no idea -- she thought I did it alone by myself at my house, which a lot of people think because I do do that.
"I sent it to her and said, 'Do you like the song?' and she said, 'I love the song. My kid loves the song -- he's made me play it five times already, so I know it's a hit. When can I cut it?' so I said, 'Immediately. Whenever you want!'” Trainor continued.
The single is Lopez's first release since reuniting with Sony's Epic Records, to which Trainor is also signed. The 46-year-old superstar performed the song for the first time on American Idol's live finale broadcast as part of a medley with "Let's Get Loud."
"I felt terrible when Jennifer got all the hate for ['Ain't Your Mama'], and it's just all ridiculous. It's such a big song for her," Trainor continued, revealing that she's worked on several songs for Lopez's upcoming full-length. "After the last album, I've been listening to this new album and I'm like, it's night and day. The music is there, the melodies are there, and a lot of my songs are self-empowerment songs, and she loved that about my writing."
For her part, Trainor is busy promoting her own LP, Thank You, due out May 13. The "All About That Bass" singer sat down with ET to spill on the inspiration behind her newest single, "No."
"I was in the clubs and I was hearing a lot of the same songs repeating themselves and I was just like, 'Ugh! DJ, spin another track. Get something else in here,'" she said.
"The club wasn't the place where my songs had played a lot -- the doo wops -- it's more like a mom's car," she added with a laugh. "I was like, 'I want something that reaches mothers, but also clubs. I want it to play everywhere.'"