Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autobuild ignores default build variant setting for Android projects #19056

Open
tmo1 opened this issue Mar 18, 2025 · 7 comments
Open

Autobuild ignores default build variant setting for Android projects #19056

tmo1 opened this issue Mar 18, 2025 · 7 comments
Labels
question Further information is requested

Comments

@tmo1
Copy link

tmo1 commented Mar 18, 2025

CodeQL autobuild apparently always tries to build the alphabetically earliest build variant for an Android project, ignoring alternate default build variant settings specified in build.gradle:

For example, my project SMS Import / Export has four build variants, and the default is set to standardDebug. Android Studio respects this, but CodeQL autobuild still tries to build legacyDebug.

@tmo1 tmo1 added the question Further information is requested label Mar 18, 2025
@rvermeulen
Copy link
Contributor

Hi @tmo1

Thanks for your question. We will investigate this and follow up with an update.

@rvermeulen
Copy link
Contributor

Hi @tmo1

Could you share the logs created in the database directory of the project that isn't build correctly so we can further investigate?

@tmo1
Copy link
Author

tmo1 commented Mar 20, 2025

I assume this is what you want - please let me know if there's anything else I should provide.

@smowton
Copy link
Contributor

smowton commented Mar 21, 2025

CodeQL autobuild simply runs gradle assemble when faced with an Android project. What Gradle target or flags would you normally pass to get your preferred variant to build? I expect for this project you'll need to switch to a manual build and specify an appropriate command: https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages#specifying-build-commands

@tmo1
Copy link
Author

tmo1 commented Mar 21, 2025

What Gradle target or flags would you normally pass to get your preferred variant to build?

As per the Google Issue Tracker and Stack Overflow links in my original post, Android Studio can use stanzas like getIsDefault().set(true) in build.gradle to invoke Gradle with the appropriate build variant specification. I'm suggesting that CodeQL autobuild should do so as well.

@rvermeulen
Copy link
Contributor

Hi @tmo1,

Thanks for the feedback, we will share this with the team.
To remediate your current issue it is best to migrate to a manual build step as adviced by @smowton.

@tmo1
Copy link
Author

tmo1 commented Mar 28, 2025

Okay - thank you!

tmo1 added a commit to tmo1/sms-ie that referenced this issue Apr 3, 2025
Configure CodeQL to use manual build and specify the StandardDebug build variant, since CodeQL autobuild tries to build the the LegacyDebug variant (and fails due to the 64K reference limit).

See: github/codeql#19056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants