Search code examples
androidandroid-studiocordovaionic-framework

Unrecognized option: --illegal-access=permit when running cordova build android


I'm running an ionic project and I'm getting the following errors when I run ionic cordova build android:

Unrecognized option: --illegal-access=permit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

This happened immediately I updated my ionic version and reinstalled JDK 8.My search online makes me understand it seems to be a very recent issue with recent versions of cordova-android and no resource I found helped solve the problem.


Solution

  • Go to the path your project /platforms/android/

    Edit the gradlew file

    Look at the end of the file in the line eval set - $ DEFAULT_JVM_OPTS and remove --illegal-access = permit

    Recompile and issue resolved