cordova run android fails to launch apps with fully qualified activity names in AndroidManifest.xml
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- android, javascript
- Domain
- mobile-dev
Research direction
Start in lib/target.js at the launch-name construction described in the issue, then reproduce with the provided cordova create, platform add android, manifest edit, and cordova run android commands. Done means apps launch successfully with both fully qualified activity names and existing relative activity names.
Written by the indexing model from the issue text.
Description
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
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 1.6k
- Avg merge
- 10h 11m
- Merged PRs (30d)
- 11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/cordova-android
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
apache/cordova-android#2018 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
apache/cordova-android#1946 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
apache/cordova-android#1929 · 5 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
apache/cordova-android#1922 · 3 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
apache/cordova-android#1919 · 18 comments · 1 reaction ·
All issues in apache/cordova-android
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·