Eclipse not displaying errors with Android - android

I relatively new to using Eclipse with the Android SDK. Whenever I encounter an error/force close, Eclipse displays a page showing "Source not found"
Is it possible to get it to show the error that is causing this? I assume this is achieved by somehow linking to the android source code. Is this mistaken?
Basically, I am struggling to identify the source of my error, and am hoping eclipse can offer more information than at present.
Appreciate any help with this,
Venatu

Source not found because the Exception is raised from something that you don't have source code, (e.g. Android SDK). You should always refer to the LogCat (Window -> Show View -> Other -> Android -> LogCat) to get the extended information about your exceptions.
Reference: http://developer.android.com/guide/developing/debugging/debugging-projects.html

Yes, most likely eclipse tries to access the android code, which isnt possible since its a library. If you get a force close or any other crash it's always a good idea to take a look inside the logcat, Android prints the stacktrace there. You can usually see exactly which function and codeline causes the issue.
Open the logcat either inside Eclipse via Window->Show View->Other->Log cat
or by starting the ddms application inside the android-sdk/tools directory.

Related

Xamarin Forms Android Error Message Regarding Support Package and other packages

I am a complete newbie who has just about started android app. development using Xamarin Forms and VS2012. Only about 20-21 days of exposure I have got. I am trying to learn along the way through writing an imaginary practice app. But there are some errors I am getting. You can see them in the picture.
http://imagebin.ca/v/29PeHoLhwW1i
Can someone direct me what exactly it is saying and what I need to do in order to rectify them?Is there something wrong with the installation/environment or like some update? Or is it something else? What's with the "unzipping failed" message?
Some one kindly help me out here please. Facing great deal of difficulty in tackling this.
Many Thanks in advance.
As the error message says (see the third error message ), you need to install the "Android Support Repository" from the Android SDK manager.
The errors are telling you that Xamarin is looking for the support library, but that it cannot find the support library and thus the build failed.
#Tanis.7x and #Jason.
Just an update I want to post:
I went about reproducing this scenario: creating a new project, do some primary simple code, add 1,2 layouts et all. When I build the new project, these 9 errors don't appear. This is strange to me. Because: this is exactly what had happened to my main work also. These errors were not there. Something, somewhere happened along the line, due to which they started appearing suddenly; out of the blue. I remember, I had updated Xamarin version, also just added some packages like JSON.Net and it is only after that this error list appeared. Not before that, if I remember correctly. Which is weird to me. If you try to recreate by creating a brand new project these 9 errors won't appear. I tried recreating this twice; no errors.
Yes, I'm manually downloading the zip file. Hopefully this makes the compiler happy. I'll keep posted about the updates.
Thanks All!

Android debugging problems

I am very new to Android and Eclipse. I find very difficult to fix up the errors in Eclipse. Android emulator keeps crashing, even for few lines of codes. Is there any tutorial or video tutorial available, that can help me to spot errors on looking at the error log.
Here is a basic tutorial that will get you familiar with Android Debugging and Logcat : Debugging in Android using Eclipse . Also you can set breakpoints and debug as you would for any other Eclipse project. The logging of errors, its different tough, using Logcat.
Yes, you can open DDMS perspective and LogCat window to view logs and can see what is the original issue.
When it crashes, check the LogCat. It contains the stack trace with the exception, and is often enough to see what went wrong and fix it. It can be browsed directly in Eclipse (don't know exactly how, I'm using IntelliJ).
Also, you can use normal debugging on your Android project, exactly the same way you would on a Java (non-Android) project.

No source attachment error when debugging Android applications

I have just started doing Android development on Mac OS X in Eclipse. When debugging an Activity, I keep getting the following errors:
The JAR file /platforms/android-10/android.jar has no source attachment.
This is starting to get very annoying, does it mean something is throwing an exception somewhere? (the message itself does not give any meaningful information as to why this is happening) I do not want to step into the source; does Eclipse do this by default? How do I disable it?
It looks like you have some error in your application. And Android subsystem throws exception. Normally, if such exception originates from android, you'll see this behavior.
What you should do:
Turn on LogCat view to see logs.
Launch your app without debugger (Ctrl+F11 on ubuntu/windows)
Inspect those logs in LogCat very carefully. They will contain the place where exception happened (originating from your code). You will then easily be able to fix the issue yourself (or ask for more assistance if needed).
In a normal development workflow you shouldn't hit cases like yours too often. Its just the learning curve :) So stay calm and keep learning.

Locating Errors When Developing Android Apps

I'm working on my first Android app and to be honest I'm not sure about most of what I'm doing. Right now I'm stuck on a NullPointerException that is created by a line that refers to another class that, in turn, refers to another class.
How can I locate the error?
The word you are looking for is debug. If you are using eclipse, it's very easy to debug your program in most cases. Two main options in eclipse are to use the logger for debug prints to logcat, or debug the program step by step to detect relevant errors. Here is a tutorial for both options and here is a nice video tutorial in YouTube regarding debug in eclipse.
You can use the Eclipse debugger to help with that. Set a break point above the line that errors out and deploy your app using the Eclipse debugger (with the little bug icon) rather than the standard deployer (the play button). You'll be able to see what is going on right before the line with the error occurs and hopefully fix things up.
If that doesn't work, you can post the stack trace and your method that has the error and we can take a look at it.

Android - Having a hard time debuging Eclipse

I am a little bit new to developing for Android using Eclipse (Coming from a .NET/Visual Studio background).
My biggest problem in developing Android app is "debugging" them. Every time the emulator throws an error, there is no message, no explanation of what caused the error. I basically have to keep doing trial/error until something works.
My question is: Is there a better way to analyze the error messages that emulator shows (basically some stack trace about Dalvik)!
Also, is it possible in Eclipse [when debugging] to move the debugging cursor backwards to re-evaluate a variable or "skip" some lines of code?
Use LogCat view to see error/debugging messages. Regular console is of very limited help. Window->Show View->Other->Android->LogCat There on the top you will see some round buttons that basically can filter log from V (verbose) to E (error). You can't copy/paste from theLogCat window but you can save selected output to text file
Regarding the error messages (I'm assuming these are the messages that show up in LogCat): I've found that analysing the error messages and working your way up the list until you reach code that is yours is the most effective way to work. Frequently (for me at least) the emulator will crash and break somewhere in the OS code (which you probably don't have the source for) but you can follow the LogCat messages back to your code and start to see where the problem is. The crash may appear to happen in the OS code, but the original cause is typically you passing something wrong to the OS.
Regarding going backwards in code: nope, at least not with the my Eclipse Ganymede install
Regarding skipping code: When your in debug mode under the Run menu you can select "Step Over" (skips going into a method) , "Step Return" to exit a method and "Run to Line" in addition to setting Breakpoints by right clicking. This causes the code to run, but you aren't single stepping through it. Otherwise the only way to "skip" lines of code is to comment it out. I believe you can also change the value of variables in the debugger, but I've never tried personally. This may give you the desired effect.
Try closing all unrelated project, switch off eclipse and then do a clean and build for the project in picture.

Categories

Resources