Skip to content

Exclude .cxx folders from git as part of the flutter create templates.  #160372

Closed

Description

@reidbaker

** /.cxx
https://stackoverflow.com/questions/66129837/about-the-gitignore-question-cxx-folder-in-the-android-project

I believe that an unintended side effect of #160260 is that we are seeing more native bin directories when working with apps.

This bug tracks updating the templates. As an aside the blog post for the next release might want to warn about this and we want to update our own repos to exclude this folder.

Activity

  1. added
    platform-androidAndroid applications specifically
    P1High-priority issues at the top of the work list
    team-androidOwned by Android platform team
    on Dec 16, 2024
  2. gmackall commented on Dec 17, 2024

    @gmackall
    Member

    Do you know what circumstances cause these cxx directories to appear? I tried building the examples/flutter_view app, as well as a new sample app from templates, and didn't see them.

  3. reidbaker commented on Dec 17, 2024

    @reidbaker
    ContributorAuthor

    They showed up while I was working on a different pr that was opened in android studio. Specifically dev/integration_test/display_cutout_rotation

  4. reidbaker commented on Dec 17, 2024

    @reidbaker
    ContributorAuthor

    Also I didnt check if the cxx directories stopped showing up without your pr. It was only a guess on my part.

  5. khoadng commented on Dec 19, 2024

    @khoadng

    Do you know what circumstances cause these cxx directories to appear? I tried building the examples/flutter_view app, as well as a new sample app from templates, and didn't see them.

    This directory is created only when I run the app in profile or release mode on a real device. It doesn't show up when building the app with flutter build

  6. gnprice commented on Dec 27, 2024

    @gnprice
    Member

    For us with the Zulip app at https://github.com/zulip/zulip-flutter, flutter build apk is enough to make an android/app/.cxx/ directory appear. So is flutter build apk --debug, and so is flutter run targeting an Android device.

    The previous Flutter commit we were using was 1c1f357 from Dec 8, and with that version we didn't have this symptom. (Now we're using 65ff060 which is from Dec 23, later than the reports above.)

    Because the directory has a ton of files in it, having it present without being in .gitignore produces an alarming amount of "new files" output for our contributors using VS Code. So I agree it should probably get mentioned in the blog post and release notes — people are definitely going to notice, and it's best if they feel they were forewarned.

  7. gnprice commented on Dec 27, 2024

    @gnprice
    Member

    Also I think the hash_key.txt file inside the generated directory confirms this is indeed due to the logic added in #160260 / 2948917 :

    $ cat android/app/.cxx/Debug/416t271r/hash_key.txt; echo
    …
    -H/home/greg/n/flutter/flutter/packages/flutter_tools/gradle/src/main/groovy
    …
    -Wno-dev
    --no-warn-unused-cli
    

    That directory is where that commit's stub CMakeLists.txt goes. And those two flags at the end are a match for those added in that code:

                    externalNativeBuild {
                        cmake {
                            // CMake will print warnings when you try to build an empty project.
                            // These arguments silence the warnings - our project is intentionally
                            // empty.
                            arguments("-Wno-dev", "--no-warn-unused-cli")
                        }
  8. gmackall commented on Jan 2, 2025

    @gmackall
    Member

    Looks like these are also gitignored in a new (pure) Android project created from Android Studio, example
    https://github.com/gmackall/help_w_a2a/blob/main/host_app/.gitignore#L14.

    Adding to the templates sounds correct to me, and I'll draft a section for the blog post.

  9. 5 remaining items

  10. corepuncher commented on Feb 22, 2025

    @corepuncher

    I am suddenly getting configure_fingerprint.bin files from android/app/.cxx/RelWithDebInfo added to my repository. Not sure which change caused this unfortunately, but I recently did the following:

    • Upgraded to Flutter 3.29
    • Upgraded Kotlin to 2.1.10
    • Upgraded Gradle plugin to 8.8.0
    • gradle-wrapper.properties to gradle-8.10.2-all.zip
  11. added a commit that references this issue on Feb 22, 2025
  12. added a commit that references this issue on Mar 5, 2025
  13. gasaichandesu commented on Mar 28, 2025

    @gasaichandesu
  14. j3g commented on Mar 29, 2025

    @j3g

    I read a lot of github issues related to this. Everyone stated the obvious of adding to .gitignore. I have done that.

    I did not find a discussion about build artifacts in our source code folders. So if I run 'flutter clean', this build artifact remains. Only method to is to remove it manually. This is bad design and hopefully someone will figure out how to move it to the build directory

    android/app/.cxx should not exist, it is a build tools failure

  15. gmackall commented on Mar 30, 2025

    @gmackall
    Member

    I read a lot of github issues related to this. Everyone stated the obvious of adding to .gitignore. I have done that.

    I did not find a discussion about build artifacts in our source code folders. So if I run 'flutter clean', this build artifact remains. Only method to is to remove it manually. This is bad design and hopefully someone will figure out how to move it to the build directory

    android/app/.cxx should not exist, it is a build tools failure

    This is a good point. I think we can configure this with https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/Cmake#buildStagingDirectory(kotlin.Any)

  16. gmackall commented on Mar 31, 2025

    @gmackall
    Member

    I read a lot of github issues related to this. Everyone stated the obvious of adding to .gitignore. I have done that.
    I did not find a discussion about build artifacts in our source code folders. So if I run 'flutter clean', this build artifact remains. Only method to is to remove it manually. This is bad design and hopefully someone will figure out how to move it to the build directory
    android/app/.cxx should not exist, it is a build tools failure

    This is a good point. I think we can configure this with https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/dsl/Cmake#buildStagingDirectory(kotlin.Any)

    Interestingly it looks like the AGP maintainers sort of disagree, and explicitly say not to to put the external native build output directory in your projects temporary build directory. I think it probably isn't a problem for us, though, as we aren't actually building anything anyways (we are just tricking AGP into downloading the NDK).

    Put up #166277 to move the build staging directory to within the build/ directory.

  17. github-actions commented on Apr 15, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  18. locked as resolved and limited conversation to collaborators on Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listplatform-androidAndroid applications specificallyteam-androidOwned by Android platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions