Android Studio No LogCat - android

Android Studio is just killing me. I'm migrating over from Eclipse and am unable to produce LogCat output. I just created a simple hello world app complete with a single line of System.out.println("hello world"); Regardless of whether I run this on an emulator or on a USB device, I get no LogCat output.
I reinstalled Android Studio, and then I got the correct output for a few executions. Now I'm back to no output. I tried restarting the computer, but this didn't correct anything.
Obviously, I can't reinstall the program every time LogCat output stops being produced, and I can't program without the ability to see console output. I'm beyond frustrated.
Here are a couple of clues:
Occasionally, I will get this error:
I am unable to run adb from the command line. Since I installed my SDK along with Android Studio, I have no idea where the adb application exists, so I don't know how to add it to my PATH variable. Even so, I don't think that this has anything to do with why LogCat output isn't produced by Android Studio.
I have tried restarting the LogCat by clicking on the icon, but this does nothing.
I realize that there are many other posts on this same type of issue, but the solutions suggested there are not resolving my issue. I am grateful for any help.

1) Don't use System.out.println. Import android.util.Log and then use
Log.e("Randall", "Hello World");
Additionally, adb should be found in your
sdk/platform-tools/adb
folder

I haven't used android studio before, I'm eclipse guy, But maybe you should try Log.d()...

Related

Android Studio can't debug if I use C code

Android Studio can't start the debugger if I use C code though JNI.
Running it normally works well, but the debugger doesn't even start, regardless if I'm debugging Kotlin or C code.
It throws a message Debugger process finished with exit code 127. Rerun 'app'
And the only detail it gave me is com.intellij.execution.ExecutionFinishedException: Execution finished.
Here I set up a simple github repository to replicate the error: https://github.com/perojas3/Android-JNI-debug-bug-example. It simply calls C code to get a string and then displays it in a toast.
And here I set up an small youtube video displaying the bug the way it is happening: https://youtu.be/8jIL5yqP7m8
I'm using Manjaro Linux right now.
I had the same issue and installing libncurses5 package solved it.
If using Ubuntu: sudo apt install libncurses5 and launch the debugger again (no android studio restart required).
I also had this issue.
I was able to run and debug my code normally, but for some reason I started to get this crash while running on debugging mode:
Debugger process finished with exit code 127
After playing a lot with Android Studio's settings and Edit Configurations, clearing caches, restarting both Android Studio and the computer and many other things, nothing was helpful.
I struggled with it a lot and the fact that there're no discussions anywhere about it annoyed me a lot, so having no information online together with the previous feeling about it happening after upgrading to Android Studio 4.2, made me think maybe it's a new issue raised in Android Studio's new 4.2 version.
So, I decided to download Android Studio 4.1.3 and give it a try. It worked like a magic and I can finally debug my code :)

Unable to launch emulator on Android Studio: EventQueue.isDispatchThread()=false, then unable to locate adb

When trying to run my device emulator on Android Studio, a pop-up appears:
Previously, I had gotten the error 'Unable to locate adb', but after replacing the default platform_tools folder with the
official version, this pop-up now replaced the last one. I don't think this is a problem with my installation, as I've uninstalled and reinstalled Android Studio and the flutter-sdk several times, each attempt met with the unable to locate adb error, then this one. Could it be the way I'm unzipping a certain file? I'm grasping at straws here.
Are there any fixes for this? To be honest, I'm not even sure where to start. I haven't seen any other page that describes getting this error while trying to launch an emulator.
Thank you for your time!
Edit: Error description in plain-text:
EventQueue.isDispatchThread()=false Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue#2c5cc720
Current thread: Thread[ApplicationImpl pooled thread 4,4,Idea Thread Group] 1175604479
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,Idea Thread Group] 1657237134
I've tried to create a new device and wipe the data on my current one, but that just results in the unable to locate adb pop-up again (I don't have an antivirus like Avaast enabled by the way), and I am absolutely certain that adb.exe is in my file-path (C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe). I have uninstalled and reinstalled platform-tools from the SDK-manager multiple times, each instance being met with this same error. I cannot run any flutter program, on any emulator. I have not yet tried with a regular Android Studio project. Any ideas?
so, i'm still not sure why the EventQueue error is showing, but what I do know is that the unable to locate adb is a negligible pop-up if you know for certain that adb.exe is in your file-directory. My issue was that I didn't have enough memory to run the emulator on my machine, so be sure to have plenty of room while developing apps (~11 gigs while using Android Studio and flutter-sdk)! That's all, it certainly was a strange experience working through it.
In my case, what helped, was to just restart an emulator.

INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES error in PhoneGap

I have made a PhoneGap/Cordova based application, that seems to work fine when tested with Chrome + Ripple.
When I'm trying to install it to my Android device(which is ADB configured, and shows up in Eclipse SDK), I get the INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES error.
By reading existing posts on the same issue, I understand that it has to deal with re-installation of the app.
But, this is the first time I am trying to run this app on any device, and I don't see how re-installing might solve the problem.
Any advice on resolving the error would be much appreciated.
Look for another app in settings->apps->downloaded that may have the same package name and uninstall it.

LogCat stops working

If my Eclipse works for over 3 or 4 hours, and I want to debug my Android app after that time, Logcat literlly dies. Only when I restart my Eclipse LogCat reborns.
I have searched but it doesn't seem that I found any solutions to these.
Any ideas?
Thanks in advance.
Yes, it's a known problem which time to time could appears in Eclipse. My investigation lead me to suggestion that a problem could be in synchronization of ADB with IDE Eclipse. Mostly was helpful a restart of ADB.
1) go to command line (console mode)
2) change dir to ...sdk\platform-tools
3) type "adb kill-server" in command prompt and execute
4) type "adb start-server" in command prompt and execute
Then check the LogCat, most likely you will see that logs running again
The last way to resolve it - just restart an Eclipse, but this way is not comfortable
It happens to my Eclipse or Android Studio too, so what I do is I just write these two lines in onCreate method of MainActivity (activity which filter's Launcher intent)
Button button = null;
button.setText("");
this crashes my app and logcat shows crash log, then I comment out these two lines and logcat keeps working on normally. I would not restart Eclipse as it would take more time.
Restart Android Studio (realizing the question asks specifically about an Eclipse issue).

Debug Android application on device without debugger

I am in a desperate situation.
I am developing an Android application using the ADT in Eclipse on Ubuntu 10.04 on a netbook.
Unfortunately the netbook is not powerful enough to run the Device Emulator (when I try there are always issues). Then, I tried to debug on-device, but unfortunately my phone (Pulse) seems to have some problem.
It seems I can't debug. I have already spent hours trying to get that working. And I can't afford to upgrade my netbook/mobile now.
The only thing I can do is developing on Eclipse and run the application on the phone.
Is there any way I can debug while the application is running on my phone? Can I create somewhere a log with errors/warnings and even some custom messages I put in the code?
What a situation.
Any help would be appreciated.
Thanks,
Dan
On device debugging should work. Make sure you have android:debuggable="true" in your application manifest. I previously had debugging issues that fixed themselves after rebooting the device.
Alternately, you can use the Log class to print out log messages. These can be seen by running adb logcat or in the logcat view of Eclipse.
Edit:
It seems that on some devices you have to run echo 1 > /sys/kernel/logger/log_main/enable from adb shell to enable logging.
You can debug an android application directly through a tool named DDMS included in the SDK. With Eclipse the plugin intgrates everything for you: just create a breakpoint on the line you want to stop to by double-clicking in the margin, then hit the 'debug' button (the little bug at the top of the window). The program will start on the device and the device will display a message 'waiting for debugger to attach'. The message should disappear within a few seconds and will stop at the line you put the breakpoint on.
As for create logs, you can use the android.util.Log class:
import android.util.Log;
...
Log.e("MYAPPLICATION", "my message");
This should show in the "Logcat" view of eclipse.
I don't understand why you wouldn't be able to debug on the device. Just make sure your device is recognized by Ubuntu by following this article.

Categories

Resources