Skip to content

Android project can't be opened in Android Studio due to wrongly set path in config.properties after cordova build android in cordova-android@14.0.1 #1842

@oli06

Description

@oli06

Bug Report

Problem

What is expected to happen?

After a successful cordova build android, it should be possible to open the app in Android Studio.

What does actually happen?

Android Studio can't open the project (platforms/android) and fails with a Malformed \uxxxx encoding. exception. This exception comes from a wrongly set path inside the config.properties in tools/.gradle (and is then copied to .gradle which is set by a cordova hook during (or after) the build command. The file contains the following content which is copied from the system JAVA_HOME variable:

java.home=C:\Users\user\.jdks\corretto-17.0.12

Instead, the \ should be escaped: java.home=C:\\Users\\user\\.jdks\\corretto-17.0.12.

This issue was introduced in cordova-android@14.0.1 with the fix: configure gradle java.home and is probably a problem only on windows machines.

Environment, Platform, Device

cordova-android@14.0.1
Windows 11

Version information

Android Studio Narwhal Feature Drop | 2025.1.2 Patch 2
Build #AI-251.26094.121.2512.13991807, built on August 26, 2025
Runtime version: 21.0.6+-13391695-b895.109 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
Kotlin plugin: K2 mode
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4096M
Cores: 32
Registry:
ide.experimental.ui=true
Non-Bundled Plugins:
com.github.copilot (1.5.53-243)

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions