Error:java.lang.NullPointerException in android - android

[2011-02-18 23:41:16 - ddms]null
java.lang.NullPointerException
at com.android.ddmlib.Client.sendAndConsume(Client.java:571)
at com.android.ddmlib.HandleHello.sendHELO(HandleHello.java:142)
at com.android.ddmlib.HandleHello.sendHelloCommands(HandleHello.java:65)
at com.android.ddmlib.Client.getJdwpPacket(Client.java:670)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:317)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
What kind of error is this..All xml files are having error suddenly like below..
Multiple annotations found at this line:
- Premature end of file.
- error: Error parsing XML: no
element found
thank you,

The first group of errors generally mean that there's a problem in the communication between ddms and the emulator you have fired up. I've found those errors to be generally harmless.
The XML errors sound like you should restart Eclipse (if that's what you're using), or else clean your project. Something got out of sync. (If the problem persists, post an example of the XML that's generating the errors.)

This error started showing up for me after I experimented with deleting files from the AVD. I must of deleted something that was important. I got rid of the error by closing the emulator and deleting the AVD in Eclipse and then recreating and running it.

Related

Issue with projectfolder called (AndroidProjects)?

I have a wired issue. If i set up a folder called AndroidProjects and put my project in there... Android-Studio fails with gradle.
one error is:
IllegalStateException:
PsiFile not parsed for file D:/AndroidProjects/MyApplication/settings.gradle.
Wait until onPsiFileAvailable() is called.
sometimes it says that gradle has a fatal error....
if i set up my projectlocation to e.g. andropro everyting is working fine.
My thoughts:
may problems with 2 big letters in projectfoldername
may foldername is to long
may android or project are registered words in android-studio
Is there a knowen issue using foldernames like i did above?
couldn't find anything on the net.

why am I getting the error "error executing aapt "

I'm getting the error executing aapt :return code 1073741819 due to which
.apk file is not generated how to fix this. How to fix if r.java file is missing
It could be a syntax or formatting error in one of the XML files. I just got this error code (it's actually negative), and I checked all the #string references and they were OK. Eventually I figured out it was because of this item in a menu XML file:
<item
android:id="#+id/action_stop"
android:orderInCategory="100"
android:icon="#drawable/ic_action_stop"
android:showAsAction="ifRoom | withText"
android:title="#string/action_stop"/>
However, the spaces around the | apparently aren't valid (XML isn't Java...). Eclipse didn't catch it as an error, but aapt crashed without giving a reason when it saw it. Not particularly graceful handling, by both Eclipse and aapt. Removing the extra spaces made everything work.
The problem with missing entries in strings.xml apparently produces error code -1073741816, not -1073741819. You have to look closely, but the last digit is different.
I'm not saying the problem is definitely some sort of syntax error. But it's another possibility that could be investigated.
I got this error when I had deleted a #string entry that was being referenced in a menu node xml resource.
I had this error and spent time trying to find a solution.
Finally the solution for this error which is: -1073741819 ( check the digits ) was a library was missing from: Properties -> Android -> Library
I just added the missing libraries and got this error resolved.
I got the same problem. What helped me was changing the Project Build Target
Properties->Android->Project Build Target

Android: Gradle Error in Android Studio

I recently added some .gifs to my /drawable so that I can use them with buttons. This worked fine (no errors). Now, when I go to rebuild/run my application, I get the following error:
Error: Gradle: Execution failed for task ':MyProject:mergeDebugResources'. > Index: 0
I'm not sure how to fix this (and there appears to be no other similar issues that I could find online.
Edit: Now it's the same error, but it also says (at the end of the first error)
Running /Applications/Android Studio.app/sdk/build-tools/android-4.2.2/aapt failed. See output
Okay, I fixed the issue. It was quite weird.
A) I had some capital letters in my res/drawables folder. Not too weird -- I can see how that would remove the first error.
B) Then, however, a lot of values in my main activity file became undefined. I had to manually import 'com.myapp.R'. Now that was weird.
Fortunately, everything is now working.
I hope that if anyone gets the same errors as me, that this response can help them.

Problems using main.xml in Eclipse (Android)

Programming for android is new for me. Therefore, eclipse is also new. I've been trying to create small things. But every example i find i need to edit in the main.xml.
My problem is, whenever i use that file, i'm getting an error. I don't know what causes it. I don't know how to get rid of it.
I've tried to follow guids on youtube. Following it to the point. Still, getting errors.
Does anyone have an idea to what causes this problem? and more important: how to solve it?
[2012-03-26 12:12:40 - No XML] emulator-5554 disconnected! Cancelling 'cyperia.noXML.NoXMLActivity activity launch'!
[2012-03-26 12:12:52 - No XML] Error in an XML file: aborting build.
[2012-03-26 12:13:00 - No XML] res\layout\main.xml:0: error: Resource entry main is already defined.
[2012-03-26 12:13:00 - No XML] res\layout\main.out.xml:0: Originally defined here.
[2012-03-26 12:13:00 - No XML] C:\Users\Illum\workspace\No XML\res\layout\main.out.xml:1: error: Error parsing XML: no element found
[2012-03-26 12:13:01 - No XML] 'default' is not a best match for any device/locale combination.
[2012-03-26 12:13:01 - No XML] Displaying it with 'Locale Language ___Region __, sw320dp, w320dp, h533dp, Normal Screen, Long screen aspect ratio, Portrait Orientation, Normal, Day time, High Density, Finger-based touchscreen, Soft keyboard, No keyboard, Exposed navigation, Trackball navigation, Screen resolution 800x480, API Level 15' which is compatible, but will actually be displayed with another more specific version of the layout.
[2012-03-26 12:13:02 - No XML] Error in an XML file: aborting build.
This is a long standing issue with Android development with Eclipse. You see this message when you run/debug a project with a .xml file opened as "current document". Eclipse tries to build the xml file instead of the project, thus throw the mysterious error.
A quick workaround would be to navigate to a .java file before you run/debug the project.
You can also select the project from workspace to run/debug it, but it'll take more clicks.
I dealt with this issue for weeks on my main machine, and finally got fed up with it. I installed Eclipse/ADT Plugin on another machine and didn't have the same issue. So this made me think of the most simple solution. Remove and reinstall! I ended up downloading Eclipse again on my main machine and reinstalling the ADT Plugin. The problem no longer exists. Note, I did not uninstall the Android SDK. I left that as is and haven't ran into the same issues yet.
TL;DR Download Eclipse and the plugin again and it should fix the issue.

Cannot run Android application on emulator/device - activity doesn't exist?

When trying to run my application on the emulator I get an error from the activitymanager:
ActivityManager: Error type 3
My activity exists, is listed in the manifest (in fact, its the MAIN launcher activity).
Anyone know what this error means?
If you are running Eclipse try Projects-->Clean... and clean the project before running again.
i faced the same issue. I cleaned the project and removed the android:enabled=false in android manifest. This solved the issue.
Check "android:installLocation" in your AndroidManifest.xml.
"preferExternal" will cause the problem.
I got this error because I used invalid characters in my project name and Android didn't warned me about it so I had no idea that was the problem...
Example: "Thís ís íncorrect!"
nothing to worry about that it happens sometimes when activity manager unable to find activity of your app that means your target that is emulator is not started yet or may be because of following reason:
when you try to run your app on emulator you may be cancled in between building or forcefully closed your emulator.In that case when try to start emulator again it will sometimes not maximized.
now you have to restart your eclipse and then launch emulator and run your app now you will not face this type of error
Dont remember how I fixed this - most probably I wiped the local copy and re-checked out of svn.
ActivityManager: Error type 3
I don't know how true it is, but I used the same shared preferences file from another app..and got this error. I chose a new name for the shared preferences and the problem has gone away. It's working now
I had not enough space on my phone, that's why I had this problem.
So I cleaned it and go RUN )
I got this error when I mistakenly added a second application tag in my manifest as I was trying to add hardware acceleration to my app:
<application
android:hardwareAccelerated="true" />.
I added it above my actual application tag and I think this resulted in Android deploying an empty 'app' to my phone. It reported 'Installation success' in the logs and yet there was no launcher icon. It did appear, though, under Settings -> Apps but the only thing I could do there was to uninstall it. Hope this helps someone.
Thus, it seems there can be many reasons to see this error.
For those who can't fix it using the above mentioned methods:
In my case, i renamed the name of my activity (using F2 in Eclipse) and it is fixed.

Categories

Resources