First off, as background: I am on a Mac, running OS X 10.6.7. Using Eclipse for an Android Development class I'm in (and hopefully eventually to actually develop directly for Android).
I had a nasty crash of Eclipse a few days ago, and after restarting I stopped getting any output from LogCat whatsoever. I tried everything I could think of, and I couldn't get anything at all to show up in the log. I tried a nuke-it-from-orbit reinstall of Eclipse, and it's at least made a little bit of a difference. When I run this code snippet I came up with to test things:
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class LogTester extends Activity {
/** Called when the activity is first created. */
public static final String TAG = "LogTester";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d(TAG, "Activity was created");
Log.d(TAG, "Anybody Home?");
}
}
...it shows me this (apparently I can't post images directly as a noob), but when I actually click on the LogTester tab of LogCat, I see nothing. The same thing vice-versa when I click back over to the main log tab, which as you can see should have 11 new items in it.
I tried changing the font since maybe there was some sort of issue with displaying the font, and I've heard there are weird issues with fonts and 10.6.7. But I get a "Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench"." error and a complete refusal to change the font type. I can't figure out where Eclipse hides this preference so I can try and fiddle with it manually.
Anyone have any ideas/suggestions as to things I should try next? This is absolutely maddening. Thanks!
UPDATE (3/31 1am): I deleted and recreated my AVM for about the 15th time and LogCat suddenly started working. Hell if I know why, but I'm not questioning it.
try switching to DDMS perspective and click on your active emulator in the Device tab. Your Logcat should refresh then.
I know this post is old but a filter got turned on for some reason using Firebase which really confused me for a few mintues while I tried to figure out what was going on.
Here's where you change the filter (in the android monitor panel):
Related
I am new to app development and have come across an issue my course hasn't yet covered but requires.
I have created a simple app that generates a log entry using Log.i after clicking a button - see screenshot below.
link to screenshot
As you may well see, no logs have been generated at all for the running emulator. This happened on an earlier app and after searching for an answer, found that going to the terminal and finding the appropriate directory, I could restart the adb using the 'kill-server' and 'start-server' commands. As this didn't work, I found the file in windows explorer and double clicked the adb.exe file. This seemed to fix the problem.
Having started another project (the one linked in the screenshot), the same problem has arisen but the same steps do not correct the issue and as such have nothing being generated in the logcat.
*beneath the emulator you see, I have nothing in the search box, the logcat is set to verbose and regex(?) is ticked.
Any help with this would be greatly appreciated as i'm reluctant to proceed with the course material before sorting out this issue.
Thanks.
some additional information I have found in the 'AVD' section of the 'Run' Window :
libpng warnings
adb successful start?
EDIT - requested code
EDIT 2 - It's a bit of a bodge but it seems the adb operator command 'logcat' used in the Terminal, turns the terminal into the logcat i.e. c:..\sdk\adb logcat' - all my missing logs, including the ones generated by the buttonClicked function appear in the terminal and new logs also appear there.
Terminal as logcat
Thank you for your responses but maybe someone knows a way to fix the logcat itself, i'd appreciate the answer. Thanks again.
I have managed to resolve the issue by closing all related software, rebooting my laptop and running the adb.exe file in the ..\android\sdk\platform-tools\ directory before launching the android studio.
Hope this helps if anyone else has the same issue.
Stitches S, I think you are not calling the buttonclicked method anywhere as I haven't seen it calling in the screenshot. But if you are calling it somewhere else then try log.d() to print that. It always works for me.
if you want to see log on button click set the buttonClick method inside the oncreate(), may be its doing nothing that's why not showing any log
this code is working in my case:
public class About_us extends AppCompatActivity {
TextView header, address;
private String Info="Info";
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contact);
header=findViewById(R.id.head);
address= findViewById(R.id.tv_address);
}
public void buttonClick(View view){
Log.d( Info,"button is clickd" );
}
}
and this is my xml view
<TextView android:id="#+id/head"
android:onClick="buttonClick"
android:layout_width="match_parent"
android:background="#color/third"
android:text="#string/app_name"
android:gravity="center"
android:textSize="20sp"
android:textColor="#color/first"
android:layout_height="30dp"/>
So I noticed when I was debugging that there seems to be a tag that's repeating through my app entitled "BubblePopupHelper" with text: "isShowingBubblePopup : false"
Screenshot of the log
To my knowledge, I'm not using or causing it. Does anyone have an idea of what's going on? The application is the one I'm writing.
Upon further inspection, I did notice that every time I'm updating text (via a TextView) it displays onscreen. If there's a better way of doing so, please let me know.
Thanks!
The message seems to be logged by some SDK libraries whenever setText is called in a TextView. I get it in Android Studio developing with min API 14.
One interim solution till Google removes it would be using the filtering feature of Android Studio by writing a RegEx that only includes your log messages. For example if I have all my tags start with 'Braim' then 'Braim.*' can be used
If you want to filter this annoying logs away you can use the following regex:
by Log Tag: (?!^BubblePopupHelper)(^.*$)
Have you added "OnGlobalLayoutListener"?
I've encountered same problem and finally I found that getViewTreeObserver().addOnGlobalLayoutListener caused the problem.
Here is my solution:
textView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
#Override
public void onGlobalLayout() {
...
textCategory.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});
I'm using Eclipse Indigo to develop Android application. The problem I'm experiencing is that some given error messages are duplicated many times, preventing the code to be compiled even when the errors are fixed. For example, I wrote:
private OnClickListener foo = new OnClickListener()
{
#Override
public void onClick( View v )
{
// ...
}
}
I was reported "Syntax error, insert ";" to complete FieldDeclaration" 7 times. I fixed it and 6 error messages remained.
I closed Eclipse then restarted it, nothing changed. I guess it is a file to delete or something like this. Any idea?
Thanks!
Here is how I fixed the problem, for those who may experience it someday.
1) I copied all the faulty (or reported as faulty but not really faulty) code to a text editor.
2) I deleted it from the java file and saved it. The errors disappeared.
3) I pasted back the code to the java file then saved it. The errors did not re-appear.
That's it.
I apologise if if 'hover assist' isn't the right terminology but I'm referring to the feature in Eclipse where if the use hovers the pointer over a method, a popup box appears with javadoc type information and invites the user to press F2 for focus. I see inconsistent behaviour for different methods, in that sometimes the browser gives me a file not found error when I click on a highlighted subject in that box.
I can best illustrate this by means of a snippet of code from a test project. I have the method:
#Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
... etc
...
}
If I hover over 'getSystemService' I see:
.
and then click on 'String' it takes me to the javadocs page
file:///C:/dev/tools/android-sdk-windows4.0/docs/reference/java/lang/String.html
on my machine in the browser. (I use the Firefox external browser) and this is just what I want.
However if I hover over the onCreate, I see:
Then if I click on the 'Bundle' link, I get this in the browser:
**File not found
Firefox can't find the file at /C:/dev/projects/EclipseIndigo/AndroidWorkTwo/CompassTwo/src/reference/android/os/Bundle.html.**
I have built the project with Android 2.3.3 jar and the javadoc properties show
which validates OK. I don't understand this inconsistent behaviour. Any help will be much appreciated.
The difference in both cases is the path "/docs/reference/java/" and "/src/reference/android/os/"
Please have a look at this url:
How to generate links to the android Classes' reference in javadoc?
It may guide you to correction.
Solved: I think it's just a plain Eclipse bug.
When I hover over the (overriden) onCreate the popup's header shows it belonging to my package and activity which extends Activity (as it must do)
If I click on the link inside the popup : Overrides: onCreate(...) in Activity
The the popup changes to show the same information but in class:
void android.app.Activity.onCreate(Bundle savedInstanceState)
Then, if I click on 'Bundle' in the new popup, all is well, we get the javadocs.
It's almost as if Eclipse thinks that the class Bundle itself has been overriden too and looks for the javadocs in my source.
Ok so I've finally cobbled enough working parts into my app that its just plain old refusing to do anything now. I understand how to use logcat, but that is about it.
The main problem at the moment is that I get the error
Activity Idle Timeout for HistoryRecord then my package
I need to learn how to do better debugging. Plus if anyone can suggest things I should do for this error please let me know.
I think its something to do with the interactions with the database.
Cheers
EDIT:
What IDE are you using, if any?
Eclipse with Android tool has
moderately good debugging facilities;
set a breakpoint and debug away.
I am using Eclipse
And I know of breakpoints, but not their real use. Where would I set them for this error?
I am used to PHP where errors tell you a specific line to look at is there a way to do this in Eclipse?
In Eclipse if you right click in the margin next to your code - easy place to start is probably in your onCreate method - you can choose to Toggle Breakpoint. This will set a breakpoint at that location.
Now, in Eclipse choose Run->Debug As->Android Application.
This will run your app in the emulator and your app with stop running at your breakpoint. At this point you can step thru your code line by line using F6 I believe.
Once you've hit the breakpoint and your code is paused, use a guide like this http://www.ibm.com/developerworks/library/os-ecbug/ which will highlight all the different things you can do at that point.
Max... If you can wrap the offending line of code in try catch you can log the exception or set a breakpoint at the exception. So for the code below that will throw an exception:
String test= null;
try {
test.length();
}
catch (Exception e) {
Log.d(TAG,"test",e);
}
LogCat will display test,java.lang.NullPointerException blah, blah, blah
OR you can set a breakpoint at the Log.d line and if hit in DEBUG mode the app will pause and the variable window in the DEBUG view will show:
this:MyApp e:NullPointerException
BUT it does not sound like your app is throwing an exception, rather it is timing out on a database call. I would stub out the call to the database and see if the timeout goes away. Then slowly add back code until it times out.
JAL