Errors with gradle and the compileReleaseJavaWithJavac task can arise from a broad range of issues. Common scenarios that result in this failure include updating an old or outdated plugin, or more recently while migrating to AndroidX.
The best practice for resolving this issue is to evaluate the plugins for the project and remove or upgrade plugins that are using the old libraries. Reporting this issue to the plugin developer is recommended so that the plugin can be fixed. In scenarios where plugins are no longer maintained, you will want to look for alternative solutions.
As a workaround, you can use
npm i jetifier. Here is the command to patch the plugin using jetifier:
npm i --save-dev jetifier
jetifier should be in the package.json file now.
Next you will need to include a postinstall script in
package.json for jetifier to run. This can be done as shown below:
Lastly, if the npm running the jetifier script needs permissions:
In the file named
.npmrc (create the file if not already present) in the root of your project, add the following contents.
If you are still seeing this error after making these changes please reach out to Appflow support for further assistance.
Article is closed for comments.