Bug Report
Problem
What is expected to happen?
cordova run android should install and launch the app successfully when the main activity in AndroidManifest.xml uses a fully qualified class name that is outside the app's package namespace (e.g., com.other.package.MainActivity instead of .MainActivity).
What does actually happen?
The app installs successfully but the launch fails with:
Error type 3
Error: Activity class {com.example.myapp/com.example.myapp.com.other.package.MainActivity} does not exist.
The activity name is incorrectly resolved because lib/target.js always uses the /. (relative) notation when constructing the launch intent component name:
const launchName = pkgName + '/.' + manifest.getActivity().getName();
For a fully qualified activity name like com.other.package.MainActivity, this produces com.example.myapp/.com.other.package.MainActivity, which Android resolves as com.example.myapp.com.other.package.MainActivity — a class that does not exist.
Information
This issue affects any Cordova plugin that overrides the main activity with a fully qualified class name via edit-config in plugin.xml. For example:
The resulting AndroidManifest.xml contains:
<activity android:name="com.other.package.MainActivity" ...>
The fix is straightforward — check if the activity name is already fully qualified and use / instead of /.:
const activityName = manifest.getActivity().getName();
const launchName = activityName.includes('.')
? pkgName + '/' + activityName
: pkgName + '/.' + activityName;
This preserves existing behavior for relative names (.MainActivity) while correctly handling fully qualified names.
Command or Code
cordova create myapp com.example.myapp MyApp
cd myapp
cordova platform add android
Add a plugin that overrides the activity with a fully qualified name, or manually
edit platforms/android/app/src/main/AndroidManifest.xml to set:
android:name="com.other.package.MainActivity"
cordova run android
Result: INSTALL SUCCESS followed by launch failure
Environment, Platform, Device
macOS
Android emulator and physical devices
Issue is in lib/target.js — platform and device independent
Version information
Cordova CLI: 13.0.0
cordova-android: 13.0.0, 14.0.1, 15.0.0 (all affected — same code at line 133 of lib/target.js)
Node.js: >= 20.7.0
Checklist
Bug Report
Problem
What is expected to happen?
cordova run android should install and launch the app successfully when the main activity in AndroidManifest.xml uses a fully qualified class name that is outside the app's package namespace (e.g., com.other.package.MainActivity instead of .MainActivity).
What does actually happen?
The app installs successfully but the launch fails with:
Error type 3
Error: Activity class {com.example.myapp/com.example.myapp.com.other.package.MainActivity} does not exist.
The activity name is incorrectly resolved because lib/target.js always uses the /. (relative) notation when constructing the launch intent component name:
const launchName = pkgName + '/.' + manifest.getActivity().getName();
For a fully qualified activity name like com.other.package.MainActivity, this produces com.example.myapp/.com.other.package.MainActivity, which Android resolves as com.example.myapp.com.other.package.MainActivity — a class that does not exist.
Information
This issue affects any Cordova plugin that overrides the main activity with a fully qualified class name via edit-config in plugin.xml. For example:
The resulting AndroidManifest.xml contains:<activity android:name="com.other.package.MainActivity" ...>
The fix is straightforward — check if the activity name is already fully qualified and use / instead of /.:
const activityName = manifest.getActivity().getName();
const launchName = activityName.includes('.')
? pkgName + '/' + activityName
: pkgName + '/.' + activityName;
This preserves existing behavior for relative names (.MainActivity) while correctly handling fully qualified names.
Command or Code
cordova create myapp com.example.myapp MyApp
cd myapp
cordova platform add android
Add a plugin that overrides the activity with a fully qualified name, or manually
edit platforms/android/app/src/main/AndroidManifest.xml to set:
android:name="com.other.package.MainActivity"
cordova run android
Result: INSTALL SUCCESS followed by launch failure
Environment, Platform, Device
macOS
Android emulator and physical devices
Issue is in lib/target.js — platform and device independent
Version information
Cordova CLI: 13.0.0
cordova-android: 13.0.0, 14.0.1, 15.0.0 (all affected — same code at line 133 of lib/target.js)
Node.js: >= 20.7.0
Checklist