DexArchiveBuilderException when building Android application with Piwik SDK

Hi all,

I’ve just included the Piwik SDK for Android into my mobile application according to this tutorial Getting started · matomo-org/piwik-sdk-android Wiki · GitHub

However, when I tried to build my application, I encountered this error: Failed to process D:\AndroidProjects\HelloWorld\app\libs\PiwikAndroidSdk-e5a05d4.jar Error while dexing org/piwik/sdk/extra/DownloadTracker.class invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> Failed to process D:\AndroidProjects\HelloWorld\app\libs\PiwikAndroidSdk-e5a05d4.jar

Anyone has ever experienced something similar? If yes, please guide me through.

This is the code in my application class:

package com.example.trungel.helloworld;

import android.os.StrictMode;

import org.piwik.sdk.TrackerConfig;
import org.piwik.sdk.extra.DownloadTracker;
import org.piwik.sdk.extra.PiwikApplication;
import org.piwik.sdk.extra.TrackHelper;

import timber.log.Timber;

public class MainApplication extends PiwikApplication {

    public TrackerConfig onCreateTrackerConfig() {
        return TrackerConfig.createDefault("localhost", 3);

    public void onCreate() {
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()

    private void initPiwik(){


Set your project to source compatibility Java_1_8 (Java8), e.g. add:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

under the Android tag to your modules build.gradle file.


1 Like

Thanks @darken. That worked for me!

solved my problem. thanks

thanks solved my problem

I have that version sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 already,still i face issue