Logcat이 내 로그 호출을 표시하지 않습니다
나는 안드로이드 프로그래밍에 대한 멍청한 놈이며 내 앱을 디버깅하는 방법을 배우고 싶었습니다. LogCat에 Log.i | d | v 호출이 표시되지 않는 것 같습니다.
사용중인 코드는 다음과 같습니다. 보시다시피 LOG_TAG 상수를 정의했지만 LogCat에서 찾을 수없는 것 같습니다. 또한 android.util.Log를 가져 왔으며 AndroidManifest에서 "debugable"이 TRUE로 설정되어 있는지 확인했습니다.
또한 이 문제를 해결하기 위해 http://developer.android.com/reference/android/util/Log.html 을 확인 했습니다.
내가 뭘 잘못하고 있죠? 내가 올바른 장소를보고 있습니까? DDMS 및 디버그 퍼스펙티브를 사용해 보았습니다. 이 멍청한 놈에게 도움을 주시면 감사하겠습니다. 감사.
내 환경 : Windows XP IDE = Eclipse 버전 : 3.6.1, 빌드 ID : M20100909-0800 에뮬레이터 = android sdk 2.1 api 7을 가리킴
// 두 개의 Log.i 호출이 포함 된 매우 기본적인 HELLO World 코드
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class debugger extends Activity {
private static final String LOG_TAG = "debugger";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(LOG_TAG, "line 13");
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.i(LOG_TAG, "CREATING NOW");
}
}
Eclipse를 사용할 때 DDMS Perspective에서 올바른 디바이스 (프로파일 레이터 에뮬레이터 -xxxx)가 선택되어 강조 표시되어 있는지 확인하십시오. 그래야만 logcat보기에서 logcat 출력을 얻을 수 있습니다.
또한 Android 플러그인은 약간 기발하고 때로는 logcat보기의 마지막 줄만 표시합니다. 이 경우 로그를 지우십시오. 그 후 모든 로그 항목을 다시 가져와야합니다 (어쨌든 저에게 효과적입니다).
다른 모든 것이 실패하면 :
나는 위의 모든 일을했는데 무엇이 잘못되었는지 알 수 없었습니다.
다음을 사용하여 테스트하십시오.
adb logcat
내 항목이 실제로 logcat에 있음을 알아 내기 위해 tdt adt의 기발한 것이 었습니다.
고치다:
이클립스 다시 시작
이것이 고쳐진 유일한 것입니다.
Android Studio를 사용하는 것과 동일한 문제가 있었고 No FiltersLogCat 오른쪽 상단의 선택 상자를 선택 하여 문제를 해결할 수있었습니다 . 이렇게하면 누락 된 로그 호출을 포함하여 백그라운드에서 Android 로그를 모두 LogCat에 수신하기 시작했습니다.

Eclipse를 다시 시작하면 로그 고양이 확인이 표시됩니다.
android.util.Log 대신 com.sileria.Log (일부 라이브러리 프로젝트에서)를 자동으로 가져 오는 것을 알았 습니다. 후자는 올바른 파일입니다. 수입품도 확인하십시오.
다음 명령으로 adb 서비스를 다시 시작해야했습니다. adb usb
이 전에 모든 로깅을 받고 디버깅 할 수 있었지만 자체 로그 라인을 얻지 못했습니다 (예, 응용 프로그램과 관련된 시스템 로깅을 얻었습니다).
I've noticed that Eclipse will sometimes throw an exception upon starting an Android app, then LogCat stops updating. I've corrected that by simply restarting Eclipse. I'm not sure if you've tried that and I know it's far from an optimal solution, but I suspect that the Eclipse plugin still has a few bugs to iron out.
Easiest way:
Check in your logcat window - TOP RIGHT corner PAUSE button || (Pause receiving new logcat messages)
Few clicks + eventually restart eclipse (usually works in my case)
There are a number of reasons why you might not see logs, most of which are listed below. Here are some steps to check most reasons:
- Make sure you don't have 'android:debuggable="false"' in your AndroidManifest.xml
- Make sure your logcat isn't paused and make sure you are scrolled to the bottom
- Your filters should either be 'no filters' or your current app
- You have the correct device selected in your logcat devices list
- If you're not getting any messages, try restarting adb. You can do that from Android Studio by clicking on the 'restart' icon, it's right after the print icon for logcat and it looks like a green curved arrow coming out of a box. If you don't see it, mouse over the '>>' that continues the icon menu when the logcat is too small.
On Android Studio: Click on the green arrow pointing to the right to restart the logging; if it is not visible, click on the >> icons to locate it.
I'm a newb as well to Android-Eclipse. Here's what it took for me to get LogCat messages to display in Eclipse: 1: add this to the class in which the logcat message is called: private static final String TAG = "MyActivity"; (per the documentation here)
2: add this Log.i(TAG, "inLayout - finished"); when you where you want to display a message
If the above doesn't work, then shutdonw Eclipse and restart it and rerun your project.
It should then work.
There is one more thing to watch for:
On the top right side of the logcat there is a dropdown table for filtering messages by type. Make sure it's on the level you are looking for (if it will be on the assert level, it will likely leave your logcat empty).
Please go to Task Manager and kill the adb.exe process. Restart your eclipse again.
or
try adb kill-server and then adb start-server command.
Probably it's not be correct, and a little bit longer, but I solved this problem (Android Studio) by using this:
System.out.println("Some text here");
Like this:
try {
...code here...
} catch(Exception e) {
System.out.println("Error desc: " + e.getMessage());
}
I spent several hours on such case. I saw only touch keys logs. Nothing more. Problem was... smarthphone. After restarting was OK. Disconnecting cable caused problem returned. Had to restart it again. Looks like the Android USB communication is not well designed.
QUICK FIX.
Just restart the eclipse
Works Perfect.
Using the SDK 4.0.3 you have to explicitly select it on debug configurations > project > target or else it will never show using Eclipse Indigo (3.7). Of course an eclipse restart ensues.
I had a problem seeing simple log output in logcat as well. My problem was solved when I installed the latest JDK. I just setup a new development machine and only had the JRE installed and instaling the JDK worked for me.
None of the other answers worked for me, but this did:
I removed my project from my workspace, then deleted anything that started with a dot (.settings, .project, etc.) from the project folder. Then I re-imported the projected. I'm missing some settings and breakpoints but at least it works.
I had been experiencing this problem and nothing seemed to work until I moved the log call into a handler. Now it works every time, no matter where you are at.
I made the mistake of typing in a search term in the logcat search box. I forgot to delete it and hence couldn't see the new logs. Since they didn't match my search term and weren't displayed.
In my case, I had to remove this line:
<application
android:debuggable="false" <!-- Remove this line -->
..../>
From Application tag in my Manifest file.
Best solution for me was restart adb server (while I have Enabled ADB integration in Android studio - Tools - Android - checked). To do this quickly I created adbr.bat file inside android-sdk\platform-tools directory (where is adb.exe located) with this inside:
adb kill-server
adb start-server
Because I have this folder in PATH system variable, always when I need restart adb from Android studio, I can write only into terminal adbr and it is done.
Another option to do this is through Android Device Monitor in Devices tab - Menu after click on small arrow right - Reset adb.
For eclipse: 1) Go to ddms perspective. 2) Make sure that correct device is selected. 3) If already selected and not displaying logs, then restart ABD. * Hope this will solve.
I restarted the ADB service as well with "adb usb" and fixes the problem for me. In fact, only one of my activities didn't log anymore. All the others did log stuff. After restart adb everything works like a charm again. For the other people who're searching for another solution: adb kill-server, adb start-server in CLI will often fix your problem aswell.
make your app force close once this will start LogCat again ...
use this for force close :D
setContentView(BIND_AUTO_CREATE);
some times the problem is not from pc on the other hand IDE,ADB etc, but it arises from your device that doesn't send logs to ADB so if you tried all the ways mentioned before and still your logcat is empty try to restart your device and try again.I tried all the ways mentioned above and neither of them worked but after a restart on my phone logcat worked like magic
I have this problems and fixed, String TAG without space:
"my tag" // noting show
"my_tag" // is ok
In my case I just had to add a name to the String. In first instance I just had a space in between the brackets
private static final String TAG = " ";
but after adding a name it worked perfectly.
private static final String TAG = "oncreate";
You're trying to put Running Code on Working space.. so try to put your code on running code..
참고 URL : https://stackoverflow.com/questions/4228641/logcat-not-displaying-my-log-calls
'Programing' 카테고리의 다른 글
| 내부 목록 이해를 열거하는 파이썬 (0) | 2020.07.23 |
|---|---|
| JavaScript를 사용하여 RSS 피드를 구문 분석하는 방법은 무엇입니까? (0) | 2020.07.23 |
| 상태 코드가있는 ASP.NET Core 반환 JSON (0) | 2020.07.23 |
| JavaScript에서 문자열을 숫자로 변환하는 가장 빠른 방법은 무엇입니까? (0) | 2020.07.23 |
| AngularJS-라디오 버튼 선택시 트리거 (0) | 2020.07.23 |