Reputation: 53
I have a bug in my Android application that I believe has to do with improper saving/loading of sharedPreferences. The bug is not easy to replicate so I'm not sure exactly what caused it originally.
I am now trying to debug my application with logs but none are hitting. I have put them as early in the code as I could think of in my MainActivity class.
In onCreate:
public void onCreate(Bundle savedInstanceState) {
Log.e("LOG REACHED","onCreate");
In onStart:
protected void onStart() {
Log.e("LOG REACHED", "onStart");
Is there any scenario where this would ever happen?
Upvotes: 1
Views: 66
Reputation: 1499
Apart from what Mahmoud said, maybe your app isn't debuggable any more due to missing tags in the Manifest or build.gradle file. Try :
android:debuggable="true"
in the appicaltion
tag in the AndroidManifest.xml file.
or debuggable true
within the buildTypes
like this buildTypes{
debug{
debuggable true
}
}
All the best :)
Upvotes: 2
Reputation: 941
It's very likely that you cannot just read the log statements although they are being printed out, because of the inconsistent behaviour of logcat sometimes, especially if you're monitoring through Android Studio. I would try the following:
Make sure I'm filtering out the correct log level, 'e' in your case.
It's worth trying to unplug/replug the device or restart the emulator.
adb kill-server
then adb start-server
Upvotes: 3