Closed maks closed 7 years ago
@maks Thanks for the PR! Yes indeed this would be helpful!
But I have one concern, wouldn't including this into the app by default mean it would be packaged even into a release app?
I think that may increase the binary size.
Also while I haven't used stetho so just guessing based on the syntax, it looks like it's acting as a proxy, wouldn't this mean if we ship it to production with stetho included, the performance will suffer?
If this is the case maybe we could add a flag somewhere to turn this on and off? I have a feeling you know much more about stetho so looking forward to your thoughts.
@gliechtenstein yes good point, this really should only be in debug builds, I'll fix that up so its not shipped in release APKs. Actually no I don't have much experience at all with Stetho (but a littel with DevTools) so thought it would be a good, easy starting point to help debugging. The main game for me is debugging JS properly within Jasonette but I'm still working on that.
@gliechtenstein I've fixed the PR to only include Stetho in debug builds, using the technique provided in the Stetho repo's sample app (swapping out the Application singleton per diff build types using gradle).
WOW THIS IS CRAZY. https://twitter.com/jasonclient/status/885554141774446593
I feel like a stone age man having done all the debugging using Android studio until now. I don't know why we didn't have this until now.
BTW just to make sure i understand correctly, do i just need to set/reset the debuggable
flag to true and false to switch back and forth? I've been trying to build an APK for both modes and looks like they generate the same file size, so wondering if i'm doing something wrong.
@gliechtenstein sorry not nearly enough documentation from my end. I've used the same approach as in the stetho sample app, where stetho is only a gradle 'debugCompile' so its only included in the debug buildtype which is the default that Android Studio builds when you do "run app" (or ./gradlew installDebug
on command line). To make that work there is a diff Application singleton class (DebugLauncher) in app/src/debug/java
When you build a release build type (eg. for a signed apkl for google play) then stetho is not included by gradle in the apk.
We could use a flag liek debuggable to enable/disable running stetho, but then it would be included in release build APKs too - but maybe sounds like that is what you would like?
@maks @gliechtenstein Thanks to this pull request ans Stetho, it would help us to easily write tests for android Jasonette from what I understand.
@realitix not so much for writing tests, but Stetho will be very useful I think for interactive debugging of Jasonette apps.
Ah i see, no I thought we had to manually enable/disable them every time.
I think this automated approach is much better. No need to add flags. Anyway, merged and merged!
Stetho allows debugging Android apps using the Chrome Developer tools. Given that Jasonette is heavily based on network and json usage, Chrome Dev tools is helpful for debugging.