How to view the log file in android studio? - android

I monitor an EditText using textwatcher i store every key press in a log file I want to view the data i put into the log file after running the application,but still couldn't find it how. appreciate the kindness in helping me :)

Assuming you're talking about the standard Android logcat (done in code something like this Log.d(TAG, "onCreate() Restoring previous state");) when you say you 'store every key press in a log file', it should show up in the Android pane of Android studio (ALT+F6) as:
If on the other hand, you're using some custom code for logging it would be implementation dependent (the file might even simply be stored on the test device).

Click on android studio View(ALT+V)->Tool Windows->Android Monitor
OR
Press ALT+6
If the value don't display yet than restart your android studio If you want only text written in logcat than just copy it

Related

Locked with Android Studio

I am locked with Android Studio.
As I was developing my first android app, I sometime pushed the "Run 'app'" button to test and see how the app was working. With no problem up to this point, but then I tried to use Image Asset Studio to make my own icon. And now when I try to use the "Run 'app'" button to test, all I can see is the image below keeping coming back and the app is no longer started. I guess I did something wrong on the way; though I have no idea what. Can anyone think of what I should do to get back on my feet and have the app working again? I haven't changed any part of the code since it was last working.
And hereafter is a second screenshot showing an error:
Running the find command on the project directory, for the file ic_launcher.webp, I get this result.
I suppose some of the files shouldn't be there.
MyMac$ find AndroidStudioProjects/MyApp -name ic_launcher.webp
AndroidStudioProjects/MyApp/app/src/main/res/mipmap-mdpi/ic_launcher.webp
AndroidStudioProjects/MyApp/app/src/main/res/mipmap-hdpi/ic_launcher.webp
AndroidStudioProjects/MyApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
AndroidStudioProjects/MyApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
AndroidStudioProjects/MyApp/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
MyMac$
But for comparison if I run the same command on the directory for a project where this issue does not appear. I find even more of the ic_launcher.webp file, so I must be missing some detail.
MyMac$ find AndroidStudioProjects/MyOtherApp -name ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/build/intermediates/packaged_res/debug/mipmap-xxxhdpi-v4/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/build/intermediates/packaged_res/debug/mipmap-hdpi-v4/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/build/intermediates/packaged_res/debug/mipmap-xhdpi-v4/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/build/intermediates/packaged_res/debug/mipmap-mdpi-v4/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/build/intermediates/packaged_res/debug/mipmap-xxhdpi-v4/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/src/main/res/mipmap-mdpi/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/src/main/res/mipmap-hdpi/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
AndroidStudioProjects/MyOtherApp/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
MyMac$

Android Log - print link to line of code in c++ file

If you print in log (fileName:lineNumber) you get a nice link in Android Monitor that gets you to that code line when you click on it. This however does not seem to work for my cpp files. Is there a way to achieve this for c++ files?
Edit
I already know how to create string (fileName:lineNumber), but when it is printed in Android Monitor it is not a clickable link. The question is how to make clickable.
To appear as a clickable link in the Android studio Logcat window, (filename.cpp:filenumber) should be associated at least with one file that is part of your AS project:
You can see that some system logs are resolved to clickable links, while the others are not.
In the example above, Socket.java is part of public API, while PlaneSocketImpl.java is not, therefore AS does not show a link for the latter.

android - Same project cannot run well

I'm developing a simple application which uses Google maps API V2, it all works fine without problems where the map displayed yesterday. Today I uses the exactly the same project, the map cannot be displayed, only the plus and minus symbol.Other parts are all fine.
Besides, it's now getting some error on xml files when i try to change any code on it, such as "Incorrect line ending: found carriage return (\r) without corresponding newline (\n)" . It's totally work fine before this.
I'm still a beginner for all these.Maybe anything wrong with my Eclipse?
It does sound like more of an eclipse/line encoding problem then an android problem.
Try opening the file's properties and then under "Resources".
You should see on the right hand side a "Text file encoding" section.
Check that these settings make sense for your platform and project.
More generally speaking, you might also wish to check your eclipse preferences.
Goto: General -> Workspace
There should be a "Text file encoding" and "New Text file line delimiter" sections.
You will want to make sure these are appropriate so this problem doesn't come back
EDIT: After changing these settings you will want to rebuild the problem (aka. Project -> Clean) to make sure it all applied

Problem in Pocketsphinx demo on Android

I try to download and run the offline voice recognization demo from this link - http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-android/ . I m successfully install and run this demo project on device, but when i push and hold the button and when i release the button, it try to convert into text. The textfield "Your text goes here" becomes empty but it is not displaying the any result, i.e. Text of What we speak.
Please any one who run this demo successfully, help me with better suggestion.
Thanks in advance.
In my experience, the text field stays blank when there is some error in the configuration for the native pocket sphinx code. Any errors encountered by PocketSphinx should be printed to the log file. Figure out where your PocketSphinx log file is; it is set using the setLogfile(String path) function. One of the things that happens to me quite often is a mismatch between the words in the dictionary and the words in the language model/grammar. Since you probably haven't edited those, I'd say it could be a wrong path to one of them. The log file will tell you about anything that couldn't be loaded.

Is there a way to get copy-and-pastable debug output in the Android SDK Emulator?

I have some information generated in the Android Emulator, and the only way I can see to get it out is using the Log class.
However, you cannot copy-and-paste from the DDMS log window. This is really annoying as I cannot use the information in another application, for example, without retyping it.
Is there a better way to get debug information out of the emulator? What happens when you write more complex applications? What do you do when you need to verify it is writing correct information to URLs, databases, files etc?
Thanks!
Using the DDMS logcat window you can select lines and copy and paste text to other windows.
If you use java.util.logging instead of the Log class you could attach a handler to write the log file out to a text file if that would make things easier. Logcat is still available when using java.util.logging but by default INFO and above is only available.
You could just use the command line logcat utility: adb logcat
Left click on a line, then CTRL + C to copy. If you wan the entire log, CTRL + A to select all, and then CTRL + C. Paste it anywhere you want.
LogCat Rows are called items.
Each item has several attributes.
Currently, you can only select one or more items and do the following things:
-Copy with ctrl+c
-Save to a text file using the save button.

Categories

Resources