Closed PaulTVungle closed 6 years ago
@PaulTVungle are you on Windows?
There's a bug in the 1.0 release on Windows where we don't automatically rebuild when the sfa changes. It's fixed internally and will be available in an upcoming release.
If you're on Windows, this is almost certainly what's causing the issue. If you are not on Windows, please let me know so I can investigate further. Thanks!
@tpsiaki
I'm sorry, I'm on MacOS High Sierra 10.13.4. Android Studio reports everything up to date, build AI-173.4720617.
Just verified again that the defect exists, changed the scale value in my sfa.
@PaulTVungle - if you open the sfb so that you can see it in the viewer, then with the sfb open (it should show you a text editor with the sfa in the left pane), modify the model scale and save the file, does a gradle build targetting the compileAsset rule for that asset start?
@tpsiaki Yes, good spot.
If I modify the sfa then Save All, the gradle build starts and when I run the app I see the changes correctly shown in the scene.
If I modify the sfa, then hit ctrl-R, I don't see the changes showing up. And trying to save after makes no difference.
@PaulTVungle - when you ctrl-R, if you look at the build output, do you see the :app:compileAsset-
No, it says createAsset-src is up-to-date but compileAsset-src it is thinking about:
:app:unzipSceneformSdk UP-TO-DATE
:app:createAsset-src_47main_47res_47raw_47star_9501 UP-TO-DATE
:app:compileAsset-src_47main_47res_47raw_47star_9501
BUILD SUCCESSFUL in 6s
3 actionable tasks: 1 executed, 2 up-to-date
If I don't modify, then yes compileAsset reports up-to-date.
is that the output you get when you ctrl-R, or just when you save the sfa with the sfb-viewer open?
This is all just ctrl-R, not saving. I have the sfa file open, make a change and then ctrl-R.
It seems that Gradle is invoking the compileAsset task ok, but for whatever reason the results don't seem to make it into the build.
is it possible that you have settings in Android Studio that make it not actually build the project when you ctrl-R? I'm surprised that you're not seeing :app:assembleDebug getting run when you ctrl-R
There is something curious going on. I've got the sfa open with the sfb viewer.
If I modify the sfa file, this is all that is run:
Executing tasks: [compileAsset-src_47main_47res_47raw_47star_9501]
Configuration on demand is an incubating feature. :app:unzipSceneformSdk UP-TO-DATE :app:createAsset-src_47main_47res_47raw_47star_9501 UP-TO-DATE :app:compileAsset-src_47main_47res_47raw_47star_9501
BUILD SUCCESSFUL in 6s 3 actionable tasks: 1 executed, 2 up-to-date
If I then press ctrl-R again, nothing edited, then I get the full build:
Executing tasks: [:app:assembleDebug]
:app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE ...
I think the only thing I've ever done to the set-up of Android Studio is just disable instant run and use a different font to stock.
The way the compileAssets rules work is they get injected into the gradle dependency graph before the mergeAssets and mergeResources rules. When they run they end up updating the .sfb that gets put in assets, or res/raw (wherever you chose on import), and then this gets picked up when merging assets/resources.
If the sfb is updated (as is happening when you save with the sfb open - which triggers just the single compileAsset rule for that sfb), then it makes sense that Gradle would know to rebuild (because it checks hashes of inputs).
The thing that confuses me though is why assembleDebug is not getting run each time you ctrl-R. When I ctrl-R it always runs this Gradle task before deploying (which generally doesn't do much if everything is up to date)
Btw as a workaround, you should be able to just build before you run, and not need to do a clean rebuild.
Thanks for the tip!
One more bit of information, if I open a Java file and make a modification, or don't, and hit ctrl-R without saving, it always runs the full assembleDebug flow.
Same if I edit a resource file too, eg. an xml layout. Can't at the moment see why editing an sfa file would change this behaviour.
In Android Studio 3.1.2, if I edit the .sfa file for a Sceneform asset (eg. adding "scale: 0.1" to the model section), the change is not reflected in the app build unless I manually visit the menu option Build -> Clean Project.
After the clean, a new build shows the changes in my scene.