invokedynamic requires --min-sdk-version >= 26

眉间皱痕 提交于 2019-11-28 20:05:35

Found my answer, for me personally it was using

implementation "com.google.guava:guava:23.0"

Instead of

implementation "com.google.guava:guava:23.0-android"
DeKaNszn

It is important part:

You need to add this in that module's build.gradle where it's not added like app module.

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

Also you forgot to add repo for plugin:

buildscript {
    repositories {
        jcenter()
        google()
    }
}

I had the same errors(SimException) that you encountered. I had 3 modules in android clean architecture project:

  • data(android library)
  • domain(plain java module)
  • presentation(app - all android stuff)

solution

navigate to File/Project Structure...

make sure your modules has the same Source and Target Compatibility (1.8 in this case)

I added a library with the compileOptions Java 1.8, and In my main project dont. Fixed adding:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

I was having the same issue. I had recently deleted my .gradle cache folder, and reinstalled Android Studio and the SDK. Eventually when trying to git bisect the problem, it went away. I can only speculate as to why this happened, but I suspect that downloading older versions of the build tools and SDK, and building (and presumably caching) versions of our code with those older tools caused it to be built in a way that didn't cause issues.

This points to some sort of bug in the way that the newer (API 26?) build tools are building the source code, and so my recommendation if you're seeing this problem and the other solutions don't work, is to lower your target SDK version to 25 or lower, install the necessary build tools, and try compiling your code with those, before reverting to build tools 26 or higher.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!