Problems using main.xml in Eclipse (Android) - 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.

Related

Android Studio Rendering: "high_quality" in attribute "breakStrategy" is not a valid integer

Rendering Problems
"high_quality" in attribute "breakStrategy" is not a valid integer
([N] similar errors not shown)
Tip: Try to refresh the layout.
([N] is a variable number.)
This message was produced after I restarted Android Studio, for all activities and any other design-able files (such xml/pref_XXX.xml files)!
I searched all project files (Ctrl+Shift+F) for "high_quality" and "breakStrategy" but found nothing!
The interesting note is no problem in designing! Just show this message.
Also, I tried Clean Project, Rebuild Project, Synchronize (Ctrl+Alt+Y), Synchronize app, pressing the refresh hyperlink inside the mentioned message, restarting Android Studio again, ... But no avail!
I have updated the android sdk build-tools, platfom-tools, API 25 and works.

Eclipse / ADT not updating package when re-running after editing XML

So this is probably a dumb question as I'm just dipping my feet into Android App development. Im using Eclipse / ADT build 21.1.0. and am running through the android developer tutorial found at http://developer.android.com/training/basics/firstapp/building-ui.html.
Which, the above link is where I'm hitting an odd snag. Following the instructions, editing the XML, then running the emulator, the app refuses to show the text fields and continues to show Hello World.
I have to assume theres a build function to update the edited XML files, but this is not described in the tutorial, and Ive followed the editing instructions specifically, I cant figure out how to update the R.java file with my new edits (tutorial suggests it does this automatically).
I know I'm making a rookie mistake... But have been unable to find a solution to move forward.
Furthermore, Im getting this on first run:
[2013-02-27 12:36:38 - MyFirstApp] W/ResourceType( 5128): Bad XML block: header size 284 or total size 0 is larger than data size 0
[2013-02-27 12:36:38 - MyFirstApp] C:\Users\jkyle\workspace\MyFirstApp\res\menu\main.xml:3: error: Error: No resource found that matches the given name (at 'title' with value '#string/action_settings').
I run it again, it runs and it says all is well.
Any help is mucho appreciated.
Add an entry like <string name="action_settings">action Settings</string> in strings.xml

Can't upload APK due to "The file is invalid: ERROR: dump failed because no AndroidManifest.xml found"

First: I'm not help vampire) I'm fighting with this issue for two days and I'm desperate to find solution. I've googled for the solution all over the inet and none is my case - this is the final stage and it feels hopeless.
To be clear: messing with AndroidManifest.xml doesn't help (no empty or unclosed tags etc). Nor app size issue (official limit is 4GB). Nor browser\system cause tried in FF, Chrome, IE 9 , Win 7, MacOSX SL 10.6.4, from my PC and from remote Server with Win2008 - same error.
Second - I extracted the AndroidManifest.xml from the APK file I submitted successfully (one with 13MB size) and extracted AndroidManifest.xml from the APK I'm trying to submit (yes, it's there! the size of this APK is 50MB) both with same apktool v 1.4.1. I compared the AndroidManifest.xml files with tortoise Diff - and the only difference between them is presence of android:targetSdkVersion="8" attribute in unuploadable APK and of course package name (diff only in .sub of com.mycompany.app.vers.sub - so i guess not a reason for this googlemare I'm having on ).
No way to give up on android:targetSdkVersion="8" - cause it can't be a reason for the error too.
Both APK were created with File -> Export -> Android -> Export Android Application with same keystore and key. I uploaded another app - third one with same AndroidManifest.xml as first one (without android:targetSdkVersion="8") but also of small size - 9MB, nothing bigger works((!
Help - I hate google and android now, almost :)
If you ran into the same problem I did with apktool, then please make sure you download the .jar file along with aapt.exe, that fixed it for me. I was running aapt.exe on an apk and got your above error, but it turns out I should have been running the apktool.bat file. The apktool.bat won't work if the .jar is not in the same directory. Get the jar file here: Android-APKTool
The maximum size of an Android app to be uploaded to Android Market is 50MB. If you're even one byte over this, I believe that the upload will fail. See this blog post for reference.

Error:java.lang.NullPointerException in 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.

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