I have to debug a simple java file, i set the breakpoint, tap the bug icon and run but it doesn’t stop on breakpoint and only run the file.
Cloud9 doesn't support debug for all languages. Java debugging is not supported. Here is a full list with languages support level in Cloud9:
https://docs.aws.amazon.com/cloud9/latest/user-guide/language-support.html
I use Netbeans for my Java IDE. I am building off a 3rd party API. I have built quite a bit on top of it. I try to leave good debugging messages around my code, but I am getting a very basic error message, then my program is closing. I get this Error - java.io.EOFException and then shortly after the program closes. I think it is just a system output printed line showing the error coming from the API.
Does anyone know of a technique in Netbeans of Java in general where I could identify where the error is coming from?
One can put a break point on the constructor for EOFException().
To do so:
From the menu select Window -> Debugging -> Breakpoints or (Alt+Shift+5)
In the Breakpoints window, right click for pop-up and choose New Breakpoint ...
Set Breakpoint Type to Method
Set classname to java.io.EOFException, for convenience click the All Methods for given class checkbox. (otherwise you would have to set different breakpoints for the different constructors)
Choose Run -> Debug Project (Ctrl+F5) to debug your program. It should stop when the EOFException is created.
Go to Window -> Debugging -> Call Stack to see where it was called from.
So I am trying to publish an Android app to the store, and I get the error message to remove all debugging from the app. Well I started to do research and the only thing I can find are post from nearly 4 years ago and people saying to use ProGuard. Well I am not exactly a Android Developer, and I don't really know any Java. I am using Android Studio to create a simple WebView application for my website. So what files and exact code do I add/remove to so I can get this published. I have added the below code the AndroidManifest.xml to the activity:
android:debuggable="false"
What else? I don't know exactly where to put the code I have seen in past StackOverflow questions. Is ProGuard now integrated into Android? I'm so confused.
EDIT** I have made sure that there are zero calls to Log, and there are no startMethodTracing() and stopMethodTracing() in my code. I am simply following the guide on how to create a simple webview app. I have created only one class myself. Also I cannot find the project.properties file in Android studio.
A few things to try:
If there are any calls to stopMethodTracing() or startMethodTracing(), make sure you remove them.
Make sure android:debuggable="false" (as you have done)
Remove or comment any references to android.util.Log such as Log.d() or Log.i()
Export your app as a signed application package, using your developer key. This automatically runs zipalign and cleans up any unnecessary resources.
(Optional) Modify your project.properties file to and uncomment the proguard.config line. This should point to a proguard.cfg file that was probably generated automatically when you created the project. Proguard will obfuscate and minimize your code.
What does LogCat do in Eclipse?
How do I use it? I have never used the log cat before in Eclipse, so I don't understand.
This is a nice and quick way to exchange information from the application on your device and the development computer.
To use Logcat, first import android.util.Log into your project. Now you can call the static class Log from your project to start logging. As you can see below, Logcat has different levels of logging. When debugging, we’ll just use Debug (D) to log the progress. Of course, when you want to log an actual error, you will use Error (E).
V — Verbose (lowest priority)
D — Debug
I — Info
W — Warning
E — Error
F — Fatal
S — Silent (highest priority, on which nothing is ever printed)
For more detail, see Debugging in Android using Eclipse.
LogCat is an Android feature that allows you viewing logs emitted by the applications running on an Android device.
When you are running your application in debugging mode from Eclipse, you can see plenty of logs appearing in this window: those of your own application, but also those posted by the system and other applications running at the same time on this device.
To log something, you have first to determine how your message is critical (is this debuggin info, an informational message, a warning or an actual error message?) and then use the appropriate method:
Log.d("myApp", "my debug message");
Log.i("myApp", "my informational message");
Log.w("myApp", "my warning message");
Log.e("myApp", "my error message");
When you run your applications in debug you can have details on why they are crashing, plus if you want to write in it you can :
Log.i(String tag, String msg);
Logcat is some kind of file where all debug information and errors are stored.
You can simply access it by either using the command "adb shell logcat" in a terminal on your developer machine with the development sdk or download an app like "alogcat" from the market.
Like mthpvg and Pratik said, it is really handy and you can write your own messages in it.
Debugging in Android using Eclipse here is good explantation of how to debug your applications using the Eclipse IDE with the Android plugins,
You use LogCat by adding commands like this in your code:
Log.d(TAG, stringVar);
The TAG is a string constant that will help filter the output from LogCat. The TAG may be the name of your Activity or Application. You use the filter in the LogCat window to see only the filtered output.
String TAG = "AppName";
The stringVar can contain anything that may be helpful for your understanding of how the code works when you need to debug it,
An example is if you are unsure of the value of an int variable (f.ex. intVal):
--- code --
String stringVar = " value of integer intVal = " + new Integer( intVal ).toString();
Log.d(TAG, stringVar);
--- code end ---
LogCat is very useful. You can add the LogCat window in Eclipse by doing this "Window -> Show View -> Other -> Android -> Logcat"
The Android logging system provides a mechanism for collecting and viewing system debug output. Logs from various applications and portions of the system are collected in a series of circular buffers.
Logcat can be accessed using the command line. More information is in logcat (at Android Developers).
If you're using Eclipse and the Android plugin for Eclipse, it's available in the Debug perspective. More (unofficial) information about this is in Debugging in Android using Eclipse.
Logcat - used for debugging purposes
Print different messages to Logcat using android.util.Log class
Syntax:
Log.d(String tag, String message)
Sample:
Log.d("LIFECYCLE","onCreate was called");
Other methods:
Log.i(String tag, String message);//i = information
Log.e(String tag, String message);//e = error
Log.w(String tag, String message);//w = warning
I think the best explanation is in How to add LogCat?
I just tried to test my first android app using the emulator, it crashed (as expected). So I load the debug view in Eclipse and now I'm not really sure what I'm looking for...
I see a tab that within the first thread I see a bunch of executions (i guess that's the right word) and they say: Source not found. and has a button that reads Edit Source Lookup Path...
Is there something wrong with my setup here?
No, there's nothing wrong with your setup. My advice is:
As you are still learning Android, use the logcat to catch know what causes your app to crash, instead of using the debugger.
Study how the eclipse debugger works and how to use it (you can learn that writting Java apps, no need of using android)