Skip to content

Conversation

@GAM3RG33K
Copy link
Contributor

@GAM3RG33K GAM3RG33K commented Dec 11, 2025

Package resolver should not depend on the package value from AndroidManifest.xml anymore, the latest android app configuration enforce adding the package name in app/build.gradle as applicationId.

Check latest documentation: https://developer.android.com/build/configure-app-module#set-application-id

Made following changes to deal with the issue:

  • Fixed package resolver code to detect applicationId in the app/build.gradle file before fallback to android manifest version
  • Added basic tests to verify the same changes

@GAM3RG33K
Copy link
Contributor Author

@microsoft-github-policy-service agree

@GAM3RG33K
Copy link
Contributor Author

@ConnorQi01 Please review the PR.
Let me know if more details are required to get context about the bug or the fix

@ConnorQi01
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ConnorQi01
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ConnorQi01
Copy link
Collaborator

@GAM3RG33K
Hi, the CI "host tests" step failed with the following error:

ReferenceError: describe is not defined
    at Object.<anonymous> (/home/vsts/work/1/s/test/extension/android/packageNameResolver.test.js:19:1)

This usually happens when test files are executed outside of a proper test environment, so globals like describe are unavailable
. Common causes:

  • The test file is run directly with Node, not through Mocha or a suitable test runner.
  • The test entry script (e.g., runTest.js) does not correctly launch the test framework.
  • The test script in package.json or runner config is incorrect.

Suggestions:

  1. Check that CI invokes the test runner correctly (Mocha or the VSCode extension test runner).
  2. Try npm test locally to reproduce.
  3. Double-check your runTest.js, imports, and test script setup in package.json, and ensure consistency with other passing tests.

Feel free to share your runTest.js or config details if you need further help debugging this.

@GAM3RG33K
Copy link
Contributor Author

@ConnorQi01 Thanks for the detailed instructions about the tests... I have fixed it, Please review the PR again.

@ConnorQi01
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ConnorQi01
Copy link
Collaborator

Hi @GAM3RG33K, thanks for this contribution!

The fix looks great - prioritizing applicationId from build.gradle is definitely the correct approach for modern Android projects, and your test coverage is comprehensive.

Before merging, could you please:

  • Squash your commits into a single commit with a clear, descriptive message
  • Create an issue describing the problem this PR solves, and link it to this PR

Once that's done, I'll merge it right away. Thanks again for your effort!

…esolution

Previously, the extension relied on `AndroidManifest.xml` to resolve the package name.

Modern Android projects often define the package name via `applicationId` in `build.gradle`,
and `AndroidManifest.xml` might not reflect the actual ID used for launching.

This change ignores `AndroidManifest.xml` package name if `applicationId` can be resolved
from `android/app/build.gradle`, ensuring compatibility with recent configuration standards.
Fallback to `AndroidManifest.xml` is maintained if `build.gradle` parsing fails.

Details:
- Implements `readApplicationId` to parse `build.gradle`.
- Updates `resolvePackageName` to prioritize the Gradle config.
- Updates tests to use the test suite, wrappers, and mock file system correctly.
@GAM3RG33K GAM3RG33K force-pushed the bugfix/package-name-resolver-for-android-outdated branch from c9bd8e2 to 5ef47d7 Compare January 9, 2026 18:38
@GAM3RG33K
Copy link
Contributor Author

This PR fixes the Issue #2493

@GAM3RG33K
Copy link
Contributor Author

@ConnorQi01 Done. Commits squashed, PR updated and Issues linked. Thanks for the clear instructions...

@ConnorQi01
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ConnorQi01 ConnorQi01 merged commit 19d4276 into microsoft:master Jan 13, 2026
5 checks passed
@ConnorQi01
Copy link
Collaborator

@GAM3RG33K Thank you for providing the updates as requested.
The changes have been reviewed and the pull request has been merged.
We appreciate your contribution to the project and your support of this effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Package resolution fails when applicationId is defined only in build.gradle

2 participants