Android 报错:AGPBI:MethodHandle.invoke are only supported starting whit android O mini api 26

Android 报错:AGPBI:MethodHandle.invoke are only supported starting whit android O mini api 26

错误

在这里插入图片描述
在这里插入图片描述
错误描述文本:

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:mergeExtDexDebug’.

Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’.
Failed to transform file ‘protobuf-java-3.10.0.jar’ to match attributes {artifactType=android-dex, dexing-enable-desugaring=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
Execution failed for DexingNoClasspathTransform: /Volumes/MyDoc/android_demo/rd_sdk/RDCloudSDK/rdcloudlibrary/libs/protobuf-java-3.10.0.jar.
Error while dexing.
Failed to transform file ‘protobuf-java-3.10.0.jar’ to match attributes {artifactType=android-dex, dexing-enable-desugaring=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.usage=java-runtime-jars}
Execution failed for DexingNoClasspathTransform: /Volumes/MyDoc/android_demo/rd_sdk/RDCloudSDK/rdcloudlibrary/libs/protobuf-java-3.10.0.jar.
Error while dexing.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it
incompatible with Gradle 6.0. Use ‘–warning-mode all’ to show the
individual deprecation warnings. See
https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 34s

解决方案

搜索到的解决方案(无法解决)

连接:@凤李坤_1129 Invoke-customs are only supported starting with Android O (–min-api 26) Message{kind=ERROR,……
方法:

在gradle.build中添加以下内容:

android {
    ....
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

最终解决方案

由于文本提示中,显示’protobuf-java-3.10.0.jar’中出现的错误,所以我将’protobuf-java-3.10.0.jar’升级为’protobuf-java-3.11.1.jar’
下载链接:https://download.jar-download.com/cache_jars/com.google.protobuf/protobuf-java/3.11.1/jar_files.zip

下载公开jar包的一个库网站供大家使用https://jar-download.com/maven-repository-class-search.php
在这里插入图片描述

完事

发布了103 篇原创文章 · 获赞 31 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/sinat_38184748/article/details/103717356