Question: I am compiling against a library that creates an AudioRecord object that captures the microphone input of my tablet.

I don't have the ability to modify the precompiled library, but I want to feed it some pre-recorded audio.

Is there a way to create some sort of loopback in android to accomplish this? 

Thanks.

Answer: 
Yes, there is an elegant tool developed by the chrome audio team, termed the Rick O'Rang loopback cable. It does a pretty good job of looping. It will take the audio input that comes out through the audio output channel and then feeds it back through the mic.

The hardware can be found here-->
<https://source.android.com/devices/audio/images/loopback_circuit.png>

There is an app that comes with it and can be found in Playstore, used to do extensive analysis of Latency and other audio parameters. But since all you need is to play something and record it, you can just assemble it, plug it into the audio jack and play things and it will do.
You can find all details about audio Loop back dongle for android CTS verifier audio testing @ <https://source.android.com/devices/audio/loopback>