Error: Invoke-customs are only supported starting with Android O (--min-api 26)
What is relevant in this stacktrace is this line:
Caused by: com.android.tools.r8.utils.AbortException: Error: Invoke-customs are only supported starting with Android O (--min-api 26)
As there is not kotlin library in your dependencies, I assume you’re working with java. I would try answers in this issue
Try to add below to your app/build.gradle
to make your Android project compilation be compatible with Java 8.
android {
....
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
....
}
for me following command in BUILD.GRADLE removed the error.
defaultConfig {
applicationId "com.example.myapptestheader"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
I just added
multiDexEnabled true
I had to remove useProguard true
from the buildTypes
configuration.
According to the documentation minifyEnabled true
is enough to obfuscate your code with R8.
Example:
android {
buildTypes {
debug {
versionNameSuffix "-dev"
minifyEnabled true // <- remove this line when using instant run
useProguard true // <- remove this line
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), "proguard-rules.pro"
}
release {
shrinkResources true
minifyEnabled true
useProguard true // <- remove this line
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), "proguard-rules.pro"
}
}
}