Question

I've already tried with no success to find a clear answer for this here, so forgive me if the answer is obvious. I'm developing an app that communicates with external devices using the USB as OTG. The problem is when a crash occurs, I can't debug it through USB debugging and of course not using the emulator. Since JellyBean, it is impossible to use third party apps to read LogCat - and in this case I have only JB device to test on.

Is there a quick and effective way to get all the logs in this case?

I've tried this in onCreate:

String filePath = Environment.getExternalStorageDirectory() + "/Download/logcat.txt";
        try {
            Runtime.getRuntime().exec(new String[]{"logcat", "-f", filePath});
        } catch (IOException e) {
            // TODO Auto-generated catch block
            Toast.makeText(this, "!!Cannot write log", Toast.LENGTH_SHORT).show();
        }

And it doesn't really write anything (tried several paths)..

Thank you in advance, Mark.

Was it helpful?

Solution 2

Actually the code above works.

Little bit embarrassing, but I forgot to add

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

In Manifest.xml

OTHER TIPS

http://ppareit.github.io/AdbConnect/ I think use the adbwireless should be a solution :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top