[FIXED] Android Tensorflow Lite 2.9.0 AAR InterpreterAPI not found Error


As per our requirement, I want to add TF Lite AAR file into our project.

So I have downloaded AAR file(2.9.0) from Maven and added to my project.Then I can imports the Interpreter and other required things, but when I try to build and run the project I’m getting InterpreterAPI class not found error like this.(please refer the screenshots][2][3]) 4 [5]

class file for org.tensorflow.lite.InterpreterApi not found

If I add below 2.7.0 version aar files, I’m able to build and run the projects but those are deprecated, I want use latest AAR file only.

Can anyone please help me on this?

Note: I should use AAR only not gradle dependencies

here the code

protected void onCreate(Bundle savedInstanceState) {
    try {
        interpreter = new Interpreter(loadModelFile());
    } catch (Exception ex) {
        System.out.println("errrrr........." + ex);
    csvDataList = new ArrayList<>();
    Button predict_button = findViewById(R.id.predict_button);
    predict_button.setOnClickListener(view -> {
        try {
        } catch (Exception ex) {
            System.out.println("errrrr......predcition..." + ex);

private void doInference() {
    if (interpreter != null) {
        float[][] output = new float[2128][1];
        interpreter.run(inputList, output);
    System.out.println("output size...." + output.length);

    } else {
        Toast.makeText(getApplicationContext(), "Interpreter is null", Toast.LENGTH_LONG).show();

private MappedByteBuffer loadModelFile() throws IOException {

    AssetFileDescriptor fileDescriptor = this.getAssets().openFd("imei.tflite"); // u can place ur model here

    FileInputStream inputStream = new FileInputStream(fileDescriptor.getFileDescriptor());
    FileChannel fileChannel = inputStream.getChannel();
    long startOffset = fileDescriptor.getStartOffset();
    long declareLength = fileDescriptor.getDeclaredLength();
    return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declareLength);


I have added one more aar file i.e tensorflow-lite-api.aar along with tensorflow-lite.aar

After adding this aar to the libs floder, I’m able to build and run my project.

here the maven link

Answered By – Madi TechApps

Answer Checked By – Candace Johnson (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published