Stitches S
Stitches S

Reputation: 65

Android Monitor logcat not displaying any messages - studio version 2.2.1

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.

Upvotes: 0

Views: 236

Answers (3)

Stitches S
Stitches S

Reputation: 65

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.

Upvotes: 3

Satyam Kamboj
Satyam Kamboj

Reputation: 54

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.

Upvotes: 0

rachna
rachna

Reputation: 124

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"/>

Upvotes: -2

Related Questions