News for hackers. Stuff that matters.
Re:Stetho: A new debugging platform for Android by evmar on Wednesday February 18, 2015 @02:39PM (#9070506)
This looks really neat! As the post suggests, we also have been doing a lot of janky Log calls to debug our app's network code.

I am really impressed by a lot of the Facebook open source releases. Each new one makes me even sadder that you can't use them due to the crazy patent license they've started using:

https://github.com/facebook/stetho/blob/master/PATENTS

"The license granted hereunder will terminate, automatically and without notice, for anyone that makes any claim (including by filing any lawsuit, assertion or other action) alleging [...] that any right in any patent claim of Facebook is invalid or unenforceable."

Re:Stetho: A new debugging platform for Android by btown on Wednesday February 18, 2015 @03:06PM (#9070627)
I was going to write a rebuttal saying that it's unlikely that any of this specific Software [Stetho] is covered by patent claims, so it wouldn't matter if you lost the license to Facebook's patents.

But then I saw this: http://stks.freshpatents.com/Facebook-Inc-nm1.php

314 patents in 2014, 69 just since the start of 2015. That's... just absurd.

Re:Stetho: A new debugging platform for Android by kej on Wednesday February 18, 2015 @03:57PM (#9070878)
It wouldn't matter if this was covered or not. Their license is saying that you can use their stuff as long as you don't question any of their patents.
Re:Stetho: A new debugging platform for Android by FeeTinesAMady on Thursday February 19, 2015 @12:40AM (#9072595)
Github would earn a lot of respect if they simply disallowed that sort of license for anything hosted with them.
Re:Stetho: A new debugging platform for Android by FeeTinesAMady on Thursday February 19, 2015 @03:39AM (#9073040)
Downvotes? Really? Github could make a stand here and disallow licenses that evil and self-serving. With this license, anybody who even uses this software can't challenge any patents of Facebook's. If Github said no, this is wrong, they would set an example for everyone else and single this out as the terrible license it is.
Re:Stetho: A new debugging platform for Android by madeofpalk on Thursday February 19, 2015 @06:41AM (#9073544)
Downvotes because its rather impractical, and Im sure many people don't want GitHub to start arbitrarily banning projects because of a random set of beliefs they have.

And then you have people that pay money to GitHub for code hosting...

Re:Stetho: A new debugging platform for Android by FeeTinesAMady on Thursday February 19, 2015 @11:45PM (#9078973)
But Github here is in the position where they are the only external party that could do something about this, because the code is hosted on their site.

> ... Im sure many people don't want GitHub to start arbitrarily banning projects because of a random set of beliefs they have

It wouldn't be unprecedented and it wouldn't be arbitrary. Google Code, for instance, only allows open source projects to be hosted with them. From what I can tell about Github, they allow any license. Doesn't mean that they can't change that policy.

Sure, it's easier to do nothing. But they alone could do something. And Facebook will get the goodwill they want from this without much kickback because nobody does anything.

Re:Stetho: A new debugging platform for Android by staticfish on Wednesday February 18, 2015 @08:21PM (#9071953)
Just an honest question: What's the benefit of using this over the adb bridge and debug bridge to debug code on-the-fly?
Re:Stetho: A new debugging platform for Android by longinoa on Wednesday February 18, 2015 @09:12PM (#9072083)
The biggest difference is you dont need to add debug code deploy, you just connect.

For things like the network traffic it is really hard to see request/response for a particular thing.

For the dumpers - those are basically a main method inside your program that you can run whenever. Its a nice way to change (or dump) state of the program, similar to adb shell dumpsys, but also allows a richer interface for changing state.

Re:Stetho: A new debugging platform for Android by staticfish on Friday February 20, 2015 @12:47PM (#9081628)
That's a great explanation. Thank you. Doesn't it cause problems not being able to pause the execution of the programme?
Re:Stetho: A new debugging platform for Android by jawns on Wednesday February 18, 2015 @03:05PM (#9070622)
PhoneGap has some debugging tools available that offer a similar approach: https://github.com/phonegap/phonegap/wiki/Debugging-in-Phone...

They've saved me a ton of time. Especially when you're using something like PhoneGap, where you're coding in JS, it's nice to have your old familiar web-based debugging console available.

Re:Stetho: A new debugging platform for Android by msoad on Wednesday February 18, 2015 @02:44PM (#9070530)
Square has the same thing for iOS:

https://github.com/square/PonyDebugger

I'm sure Facebook was inspired with PonyDebugger to create this.

Re:Stetho: A new debugging platform for Android by mrvagabond on Wednesday February 18, 2015 @07:21PM (#9071774)
I skimmed through their github page, but didn't see if they offer view hierarchy debugging. Being able to easily navigate an xml dump of the screen would be amazing using Chome Tools. Android Device Monitor is not the most elegant of interfaces.
Re:Stetho: A new debugging platform for Android by longinoa on Wednesday February 18, 2015 @09:10PM (#9072072)
As others have mentioned we are working on getting a hierarchy viewer built now.
Re:Stetho: A new debugging platform for Android by stevebot on Wednesday February 18, 2015 @08:09PM (#9071911)
agreed, it looks like there is this open ticket:

https://github.com/facebook/stetho/issues/14

Would be really dope if they got that integrated into the elements tab.

Re:Stetho: A new debugging platform for Android by stevebot on Wednesday February 18, 2015 @03:12PM (#9070656)
Ah and I had just finally coughed up 50 dollars for my Charles license. Charles is a nice tool, but this seems so much nicer as I don't see anywhere that the user is required to setup a proxy manually on the phone.

This does make me wonder how their HTTP debugging works? I am assuming that data is passed over USB. Are they using ADB underneath this all?

Re:Stetho: A new debugging platform for Android by yincrash on Wednesday February 18, 2015 @03:37PM (#9070767)
It uses the same mechanism that Chrome dev tools remote debugging uses which is a local websocket server accessed over adb. [1][2]

[1]https://github.com/facebook/stetho/blob/master/stetho/src/ma...

[2]https://developer.chrome.com/devtools/docs/remote-debugging

Re:Stetho: A new debugging platform for Android by rentnorove on Wednesday February 18, 2015 @06:20PM (#9071557)
It requires you to compile a proxy into the application:

    OkHttpClient client = new OkHttpClient();
    client.networkInterceptors().add(new StethoInterceptor());
Re:Stetho: A new debugging platform for Android by stevebot on Wednesday February 18, 2015 @08:06PM (#9071905)
How is that really a proxy if it gets compiled into your application? From what others have said it sounds like the real mechanism is over adb.
Re:Stetho: A new debugging platform for Android by longinoa on Wednesday February 18, 2015 @09:17PM (#9072093)
Its not a proxy, it requires that you build hooks into your http engine (OkHttp/HttpUrlConnection) to forward events to the NetworkEventReporter interface.
Re:Stetho: A new debugging platform for Android by tarnic on Friday February 20, 2015 @02:28AM (#9079373)
Looks cool! But wait: does it mean that we have to add this instrumentation code when debugging, but when releasing to the Play Store, we have to remember to remove it? Or does it work only when the app is not signed and you can attach the debugger?
Re:Stetho: A new debugging platform for Android by jasta on Saturday February 21, 2015 @11:28AM (#9085915)
Currently our recommendation is to use an if (DEBUG) block around your initialization and then use proguard to remove the dead code in release. We are working on a better solution which allows you to use build flavors in gradle. The proguard solution is how Facebook apps strip it out today, however.

That said, it is safe to ship the stetho engine in your release apps and it adds virtually no runtime overhead to initialize due to our deferred init design. For instance, Chrome for Android ships with the same system we have and it is always enabled even for release builds.

See https://github.com/facebook/stetho/issues/16 to track our progress addressing this issue.

Re:Stetho: A new debugging platform for Android by aceperry on Wednesday February 18, 2015 @04:56PM (#9071220)
Nice. Reminds me of a software monitor. Can't wait to see what other features will become available.