Unity -> Cannot print apk with "Error: MethodHandle.invoke and MethodHandle.invokeExact are only~" when building a release on AndroidStudio

Asked 2 years ago, Updated 2 years ago, 86 views

Unity 2017.4.10 f1
Admin:Google Mobile Ads Unity Plugin v3.15.1 (latest)
AppLovin: GoogleMobileAdsAppLovinMediation-4.0.0.zip (latest)

In the above environment, modify build.gradle and Manifest as appropriate on AndroidStudio after exporting gradle build.

Now I can output up to the debug apk without any problems.
However, if you try to print an apk for release.

Enter a description of the image here

This error occurred.

Error: MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O(--min-api26)

Enter a description of the image here

As per the error, if the minSdkVersion is set to 26, it will succeed.
As it is limited to Android 8.0 or higher, I would like to set minSdkVersion to 19 or higher at least, but
Is there any way?

(If you output an apk file in debug, the app will run without any problems with Android OS 7.0 devices, so
I looked into various solutions, but I couldn't find them, so I'd appreciate it if you could help me.)

Tried

  • Cannot build directly on unity, internal, gradle build, custom gradle template, etc.
  • I have tried various versions of SDK, JDK, and NDK.
  • Adjusting maven and gradle versions of build.gradle, adding groovy:groovy-all, etc.
  • Is it possible that you are using the Invoke() method on Unity?

unity3d android-studio firebase gradle admob

2022-09-30 14:36

1 Answers

I'm very sorry for the viewers!

Is it possible that you are using the Invoke() method on Unity?

Here I actually replaced all the Invoke() methods with coroutine and rebuilt them.
I was able to build it on minSdkVersion19 without any problems!!! (ToT)

I also used the Invoke() method in the NGUI library, and just in case, I also responded by commenting out. (Crying)


2022-09-30 14:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.