Skip to content

Enable Android API 23+ support by using AviatorScript interpreter mode#509

Closed
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-methodhandle-invoke-error
Closed

Enable Android API 23+ support by using AviatorScript interpreter mode#509
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-methodhandle-invoke-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

jCasbin fails to build on Android projects with minSdk=23 because aviator 5.9.0 uses MethodHandle.invoke/invokeExact, which requires Android API 26+.

Changes

Core library:

  • Configure AviatorEvaluatorInstance to use EvalMode.INTERPRETER instead of default ASM mode
  • Interpreter mode avoids MethodHandle APIs while maintaining full functionality

Tests:

  • Update test fixtures to use interpreter mode for consistency

Documentation:

  • Add Android compatibility section noting API 23+ support

Implementation

// Before
aviatorEval = AviatorEvaluator.newInstance();

// After
aviatorEval = AviatorEvaluator.newInstance(EvalMode.INTERPRETER);

AviatorScript's interpreter mode was specifically designed for Android and non-standard JVM platforms (added in aviator 5.3.0). It executes expressions without bytecode compilation, eliminating the dependency on MethodHandle APIs.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • central.sonatype.com
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • www.yuque.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)</issue_title>
<issue_description>Hello,
i have Kotlin Jetpack Compose project (minSdk=23). i added jcasbin as dependency.
but on project build i got error:

Execution failed for task ':app:mergeExtDexDevDebug'.
> Could not resolve all files for configuration ':app:devDebugRuntimeClasspath'.
   > Failed to transform aviator-5.9.0.jar (io.github.aviatorscript:aviator:5.9.0) to match attributes {artifactType=android-dex, dexing-component-attributes=ComponentSpecificParameters(minSdkVersion=23, debuggable=true, enableCoreLibraryDesugaring=true, enableGlobalSynthetics=false, enableApiModeling=false, dependenciesClassesAreInstrumented=false, asmTransformComponent=null, useJacocoTransformInstrumentation=false, enableDesugaring=true, needsClasspath=true, useFullClasspath=false, componentIfUsingFullClasspath=null), org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /Users/longman/.gradle/caches/modules-2/files-2.1/io.github.aviatorscript/aviator/5.9.0/d4888920be26d2038eadd6c3002b014f64008655/aviator-5.9.0.jar.
         > Error while dexing.
           Increase the minSdkVersion to 26 or above.

i tried old releases of jcasbin, but without any luck.

are there possible ways to use jcasbin on API 23+?

thanks!</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

…ompatibility

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MethodHandle.invoke and invokeExact support for lower SDK Enable Android API 23+ support by using AviatorScript interpreter mode Feb 5, 2026
Copilot AI requested a review from hsluoyz February 5, 2026 14:42
@hsluoyz hsluoyz marked this pull request as ready for review February 5, 2026 14:44
@hsluoyz hsluoyz closed this Feb 5, 2026
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.05%. Comparing base (6504a9e) to head (2dc4fdd).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #509   +/-   ##
=======================================
  Coverage   68.05%   68.05%           
=======================================
  Files          63       63           
  Lines        3083     3083           
  Branches      574      574           
=======================================
  Hits         2098     2098           
  Misses        801      801           
  Partials      184      184           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MethodHandle.invoke and MethodHandle.invokeExact are only supported starting with Android O (--min-api 26)

4 participants