Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Networking Making an HTTP GET Request with OkHttp

Log File Error

Using Synchronize approach. I am debugging application on my android phone moto g(2). App crashes but i am not able to get any log file and not able to see error"main thread expression" in my android studio.

Tab: logcat Log Level: verbose Filter: app: com.example.******.stormy. but when i change to 'no filter' then i can see log file but i cant find "Main Thread Expression".Please help.

Thanks

I am facing the same issue. What could I be doing wrong? :S

8 Answers

Hello,

First, a few sanity checks to start debugging this. Is ADB integration enabled in Android Studio? Its located in Tools, Android, Enable ADB Integration. Second, do you see any output when you run the command "adb logcat" from a terminal?

Sometimes Android Studio likes to stop gathering logcat data so before you begin your test, you should clear Android Studio's logcat info and then click the resume gathering logcat button.

ADB Integration is Enabled. i don't see any output in adb logcat. Help is Appreciated. Regards

Hello,

The other thing that I can think of off the top of my head is to make sure USB debugging is enabled on your phone. You will need to enable Developer options by going to Settings, About Phone, and tap the Android version 7 times. After this, go to Settings, Developer Options, and enable USB debugging. You will hopefully have a dialog open up when you connect it to your computer asking if you want to allow your computer access, accept it.

i did all what you recommended but still no effect. Any other which u can think and suggest, because i tried googling it but no help. Help Thanks and Regards

I want to make sure the basics are all right. Do you get any output from the command "adb devices"? If so, does it say device at the end of the line with the serial number of your phone? Or something like offline, no permission. Also, let me know if it says ?????????? instead of your DSN.

Mine got fixed with a clean and rebuild of the project. Also see if you are declaring the LOG variable in the MainActivity class and not in it's member functions like onCreate.

i am still struggling, it is showing unable to open debugger port: java.io.IOException"HandShaking failed". i search some forum but it is showing check adb update and then run "./adb get-state" in terminal followed by restart but still it failed.

Hello,

What OS are you running? When you type in "adb devices" into a terminal window while the phone is connected what is the output?

Also, what version of Android Stuido are you using?

OS X 10.10.3, Android Studio 2. adb is enabled but when i run adb logcat, no output. i ran ./adb --help, bash: adb: command not found. i thought maybe this is because my adb is not setup i tried some help from stackoverflow(http://stackoverflow.com/questions/17901692/set-up-adb-on-mac-os-x), tried this command in terminal in android studio(echo 'export PATH=$PATH:/Users/akashdeepsingh/android-sdks/platform-tools/' >> ~/.bash_profile). and still no log and cant even run the app in debugger mode. this is driving me crazy. P.S. All Update done, if their is some special update that i should crosscheck. help

I think I've found a fix. Some of you may still be using the beta version of Android Studio (which is full of bugs). Update it to 1.0+ and you should be okay.

http://stackoverflow.com/questions/26244998/androidmanifest-in-androidtest-directory-being-ignored

It seems like the android manifest used to be ignored in earlier versions.

Wait. Never mind that. That may still fix it though. I found another method. Click on File>Invalidate Caches and Restart

Android Studio will restart after that but you should be okay then