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

  • 错误
  • 解决方案
    • 搜索到的解决方案(无法解决)
    • 最终解决方案
  • 完事

错误

Android 报错:AGPBI:MethodHandle.invoke are only supported starting whit android O mini api 26_第1张图片
Android 报错:AGPBI:MethodHandle.invoke are only supported starting whit android O mini api 26_第2张图片
错误描述文本:

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
Android 报错:AGPBI:MethodHandle.invoke are only supported starting whit android O mini api 26_第3张图片

完事

你可能感兴趣的:(错误,android)