Invoke-customs are only supported starting with Android O (--min-api 26)

Android 目录:https://blog.csdn.net/dkbnull/article/details/87932847

 

开发安卓项目时,引入了自己之前封装的一个jar包,该jar包使用了一些Java8特性,引入之后sync成功了,但是等到编译的时候就报错:

Android issues:
    Invoke-customs are only supported starting with Android O (--min-api 26)	
Java compiler:
    com.android.builder.dexing.DexArchiveBuilderException: Failed to process xxxxxx\app\libs\util-1.0.12.jar	
    com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.	
    com.android.tools.r8.CompilationFailedException: Compilation failed to complete
    com.android.tools.r8.utils.AbortException	

Invoke-customs are only supported starting with Android O (--min-api 26)_第1张图片

在 build.gradle 中增加如下代码:

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }

如下图所示

Invoke-customs are only supported starting with Android O (--min-api 26)_第2张图片

再编译,成功。

 

你可能感兴趣的:(┣━,Android,┣━━━,Android,常见问题,Android,从零单排)