Android says min-api 26


#1

Hello,

I am trying to get a simple demo app going so I can learn to use the Android Device Setup Library. I have followed the instructions here. That is I have added “implementation ‘io.particle:devicesetup:0.5.3’” to my build.gradle for my app module. Other than that the app is an empty activity with an added button to call the initWithSetupOnly method in its onClick listener. When I try to build the app I get “Compilation failed to complete” with 5 errors.

Errors:

Invoke-customs are only supported starting with Android O (--min-api 26)
Message{kind=ERROR, text=Invoke-customs are only supported starting with Android O (--min-api 26), sources=[Unknown source file], tool name=Optional.of(D8)}

Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Colin\.gradle\caches\transforms-1\files-1.1\cloudsdk-0.4.9.aar\19f92468c2e3734a4b7c4574815eb1cb\jars\classes.jar

Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.

Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete

Caused by: com.android.tools.r8.utils.AbortException

If I set minSdkVersion to 26 as is suggested by the error message the build completes successfully, but I was hoping to set the minimum version lower. I see that the Particle Tinker app has minSdkVersion set to 15.

Can anyone tell me what I’m doing wrong?

My Android studio about panel:

Android Studio 3.1.1
Build #AI-173.4697961, built on April 3, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

-Colin


#2

The way I worked around this was to use the 0.4.9 version of the device setup SDK. It only requires API 15.

Instructions here:


#3

Thanks for that. I changed

implementation 'io.particle:devicesetup:0.5.3'

to

implementation 'io.particle:devicesetup:0.4.9'

and

implementation 'com.android.support:appcompat-v7:26.1.0'

to

implementation 'com.android.support:appcompat-v7:26.0.1'

in my build.gradle and now my build succeeds.