Fixed
Status Update
Comments
uc...@google.com <uc...@google.com>
ar...@google.com <ar...@google.com>
jo...@google.com <jo...@google.com> #2
Tried:
- Using top-of-tree branch
- Create new C++ project
- Build
- Edit app/build.gradle
- Accept Android Studio prompt to sync
- Build
- Outcome for each edit I tried
1) Insert a comment in build.gradle: No rebuild as expected
2) Delete a dependency in build.gradle: No rebuild as expected
I'll try 3.6 ToT now
- Using top-of-tree branch
- Create new C++ project
- Build
- Edit app/build.gradle
- Accept Android Studio prompt to sync
- Build
- Outcome for each edit I tried
1) Insert a comment in build.gradle: No rebuild as expected
2) Delete a dependency in build.gradle: No rebuild as expected
I'll try 3.6 ToT now
jo...@google.com <jo...@google.com> #3
Looking at json_generation_record.json I see:
{
"level": "INFO",
"message": "- force flag, will remove stale json folder",
"file": "/Users/aclement/Documents/iZoSrc/hook-android/Spire/spire_native/CMakeLists.txt",
"tag": "debug|arm64-v8a"
},
It looks like probably the force flag has been set somewhere.
{
"level": "INFO",
"message": "- force flag, will remove stale json folder",
"file": "/Users/aclement/Documents/iZoSrc/hook-android/Spire/spire_native/CMakeLists.txt",
"tag": "debug|arm64-v8a"
},
It looks like probably the force flag has been set somewhere.
al...@gmail.com <al...@gmail.com> #4
I was able to repro this with a simpler test case in both 3.6 and 4.1 Canary. Hope this can help.
* Uninstall previous version of Android Studio 3.6 and clear preferences (rm -rf ~/Library/Preferences/AndroidStudio3.6)
* Install Android Studio 3.6.1
** Select “Do not import settings” in dialog
** Select “Standard” install type
* In the new project wizard, select “Native C++”
** Use default minSDK and default C++ toolchain
* Wait for initial sync to complete
* Build -> Make Project
** Build Output shows “[1/2] Building CXX object …” for each architecture. Also present in the android_gradle_build_native-lib_<arch>.stdout.txt.
* In /app/build.gradle, downgrade androidx.appcompat:appcompat to 1.0.0
* Click “Sync Now” in top notification
** All files in .cxx/debug/x86 (the active build variant in the Build Variant tab) will update (the modified dates update). Files in the non-active build variant will not update.
json_generation_record.json now contains “- force flag, will remove stale json folder”
* Build -> Make Project
** Build Output shows “Building CXX object CMakeFiles/native-lib.dir/native-lib.cpp.o” under “Build native-lib_x86” and “ninja: no work to do.” for other, non-active ABIs. Ditto in the android_gradle_build_native-lib_<arch>.stdout.txt files.
The force flag appears to be set during the Gradle sync after updating the androidx dependency. I've also learned that the rebuild only seems to occur for the configuration active in the Build Variants tab.
I’ve attached three copies of the .cxx folder again, from different points in time: after the initial build, after updating the dependency and syncing, and after the build after that sync. I’m on MacOS Catalina 10.15.2, MacBook Pro (15-inch, 2017).
I did some digging in AS’s source and found a reference to an older issue in ExternalNativeJsonGenerator.java that seems similar (albeit slightly different):https://issuetracker.google.com/issues/69408798 . This StackOverflow question (https://stackoverflow.com/q/58063705/4817013 ) also seems to be a similar issue and was opened recently, perhaps highlighting that this could be a recent regression.
This is currently blocking my team from updating from 3.4 and we would really like to! Please let me know if there’s any other data I can get to help you out.
Thanks,
Alex
* Uninstall previous version of Android Studio 3.6 and clear preferences (rm -rf ~/Library/Preferences/AndroidStudio3.6)
* Install Android Studio 3.6.1
** Select “Do not import settings” in dialog
** Select “Standard” install type
* In the new project wizard, select “Native C++”
** Use default minSDK and default C++ toolchain
* Wait for initial sync to complete
* Build -> Make Project
** Build Output shows “[1/2] Building CXX object …” for each architecture. Also present in the android_gradle_build_native-lib_<arch>.stdout.txt.
* In /app/build.gradle, downgrade androidx.appcompat:appcompat to 1.0.0
* Click “Sync Now” in top notification
** All files in .cxx/debug/x86 (the active build variant in the Build Variant tab) will update (the modified dates update). Files in the non-active build variant will not update.
json_generation_record.json now contains “- force flag, will remove stale json folder”
* Build -> Make Project
** Build Output shows “Building CXX object CMakeFiles/native-lib.dir/native-lib.cpp.o” under “Build native-lib_x86” and “ninja: no work to do.” for other, non-active ABIs. Ditto in the android_gradle_build_native-lib_<arch>.stdout.txt files.
The force flag appears to be set during the Gradle sync after updating the androidx dependency. I've also learned that the rebuild only seems to occur for the configuration active in the Build Variants tab.
I’ve attached three copies of the .cxx folder again, from different points in time: after the initial build, after updating the dependency and syncing, and after the build after that sync. I’m on MacOS Catalina 10.15.2, MacBook Pro (15-inch, 2017).
I did some digging in AS’s source and found a reference to an older issue in ExternalNativeJsonGenerator.java that seems similar (albeit slightly different):
This is currently blocking my team from updating from 3.4 and we would really like to! Please let me know if there’s any other data I can get to help you out.
Thanks,
Alex
ar...@google.com <ar...@google.com> #5
I'm not sure if I understand your problem correctly. When build.gradle is touched/changed, we can't tell if there is any C++ build section that's affected without doing a sync. So we force the json generation and rely on Ninja to figure out that there is no changes needed if no C++ flags are changed. I'll take a look at your repro more carefully, but this sounds like it is by design.
jo...@google.com <jo...@google.com> #6
I've submitted a fix for this one. It should be available in AS 4.1 canary 4
al...@gmail.com <al...@gmail.com> #7
I've confirmed this is fixed in AS 4.1 canary 4. Thank you both very much!
al...@gmail.com <al...@gmail.com> #8
A heads up: this was included in the release notes for 3.6.2 but does not appear to be fixed in that version.
ar...@google.com <ar...@google.com> #9
Thanks for the update. Yes, this shouldn't be mentioned in the 3.6.2 list of fixes.
ar...@google.com <ar...@google.com> #10
It's now been removed form the 3.6.2 release notes.
Description
* "Make project"
* Make change (e.g. upgrade dependency) to any Gradle file (e.g. project module, dependency module, etc.)
* "Sync Project with Gradle Files?
* "Make project"
Results:
All native code in my native module rebuilds from scratch.
Notes:
* This seems to be a new issue as of Android Studio 3.5 and is still present in the 3.6 Beta 1. I am not able to reproduce it in 3.4 with the same Gradle, AGP, SDK versions.
* My project is set up with a top-level project ("Spire") and two child modules, :app and :spire_native. :app depends on :spire_native via "implementation project(':spire_native')". The issue seems to repro if I make a change to any of the Gradle files and sync.
* When syncing after the Gradle file change in versions after 3.4, everything in ".externalnativebuild/cmake/debug/<arch>" (or ".cxx/cmake/debug/<arch>" in AS 3.6 Beta 1) seems to be wiped out and recreated during the sync. I suspect this is may be the cause of the issue.
* The issue does not reproduce if I run "Sync Project with Gradle Files" without making a change to any of the Gradle files.
I've attached the contents of .cxx/cmake/debug/arm64-v8a both before and after the Gradle sync, the project Gradle files, and the top-level CMakeLists.txt.
Gradle version:
3.6.1
Android Plugin Version:
3.6.0-beta01
Module Compile Sdk Version:
28
Module Build Tools Version:
28.0.3
Android SDK Tools version:
26.1.1