Since yesterday everytime I open my layout Editor in Eclipse for the Android UI I get the following exception:
Unhandled event loop exception
java.lang.StackOverflowError
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.isTheme(Unknown Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.isTheme(Unknown Source)
at...
the last part goes on and on as expected if an Stackoverflow Exception occurs.
Anybody else experiencing this and found a solution?
I'm working with the latests android sdk on Mac OS X with Eclipse 3.5.2
I just installed the Carbon Version of eclipse and I get this error even in this fresh copy of eclipse.
Very strange that I'm the only one experiencing this error. Maybe it is not an Eclipse problem but an problem of my project setup...
The same thing happened to me, and I had to dig a lot before I found a solution. In my styles.xml I had an entry where the name and parent attributes were identical:
<style name="MyHeader" parent="MyHeader">
<item name="android:background">#drawable/header_background</item>
</style>
By removing the parent attribute the layout editor finally worked again:
<style name="MyHeader">
<item name="android:background">#drawable/header_background</item>
</style>
I have not had that particular error, but I have had various project corruption problems related to resources. Sometimes cleaning the project and rebuilding fixes it. Sometimes I have had to revert some project files in subversion. Sometimes just relaunching eclipse fixes things. There is also a Fix Project Properties item in the Android Tools of the context menu that has helped once or twice.
Related
I am trying to migrate an Android Studio 3.0 project to Android Studio 3.1.1, which enables the Android gradle plugin 3.1.1 and the new AAPT2 resource processor. I think my problems stems for either of these.
Basically, when I try to gradle sync my project, the error I get is
Users/user/src/app/app-1/src/main/res/values/styles.xml:599:5-608:13:
AAPT: error: :item>.
I have no idea what the error could be based on this error message alone. Googling around for it didn't seem to find anything either. The line this error message points to is nothing special, just a style declaration:
<style name=“AppEditText" parent="BigEditText">
<item name="android:gravity">left</item>
<item name="android:textCursorDrawable">#drawable/drawable</item>
<item name="android:background">#android:color/transparent</item>
…
</style>
Based on the error position and knowing that AAPT2 is now on (it was off previously), I am concluding that the error has something to do with resources, but I have no idea what's wrong.
My project consists of two apps and a commons module both of these apps depend on. The commons module implements some UI components also. Not sure if this is relevant or not.
How would I debug this further?
Update: When I looked at the merged values.xml, as processed by AAPT2, I can see the resulting values.xml contains something strange.
<ns3:item name="layout_columnWeight">1</ns3:item>
<ns3:item name="layout_rowWeight">1</ns3:item>
It looks like the error is from these lines. But how would they have ended up there? Who would add the ns3 namespace and why?
Ok - I finally found out the reason for this.
As a hint for anyone else struggling with these kinds of issues, you should go to the console and do a gradle build with the --info flag and it will tell you in which file the error is happening in while it is processing the resources. This is how I managed to actually see where the error was as the issue was in one of the merged resources files that the developer normally never sees.
The issue was that in some of our XML resources files, the namespace that was specified was support and/or an namespace auto-res line was specified for an element and now caused issues with AAPT2. I don't know why it had worked before, but this was now causing issues with AAPT2. Removing those namespace declarations solves the issue.
I'm using 1.4. I've tried to uninstall and reinstall again. still same problem. any solution?
Try just building the project: Build -> Make Project
If that doesn't work try cleaning the project: Build -> Clean Project
That happened to me as well and all I had to do was build the project. Then it was able to render it.
Go to app-res-values->styles.xml then;
Change,
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
to
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
this worked for me.
I just upgraded to Android Studio 1.5 and I ran into this same issue with new created projects. I tried invalidate the cache and rebuild the project. Sometimes that will fix the initial rendering, but any changes I make to the layout will not be reflected on the Design view.
The problem seems to be related to the embedded layout mechanism. After creating a new project (with Blank Activity), I got content_main.xml to display by removing the line tools:showIn="#layout/activity_main". Similarly, remove <include layout="#layout/content_main"/> from activity_main.xml and the Design view should render properly.
Did you try to remove android studio cache folders after uninstalling? they located on
C:\Users\<username>\.android, ..\.AndroidStudio1.4, ..\.gradle.
And then try to install studio again
Steps
Clean project
Build project
Close .xml files
Reopen them
That worked for me
Close android studio and reopen. Then rebuild project.
In my situation there was a silent error in my activity .xml file.
I accidentally positioned an item outside of my GridLayout (the child's layout_row/layout_column was too high). I'd expect Android Studio to report mistakes like this, but instead the design view just stops working.
So if your design view stops working and the other answers don't help, you might have an unreported error in your .xml file.
I am working through the tutorial on the android developer site.
whenever I add this item to the xml file it generaates an error:
<!-- Search, should appear as action button -->
<item android:id="#+id/action_search"
android:icon="#drawable/ic_action_search"
android:title="#string/action_search"
android:showAsAction="ifRoom" />
everyelse seems to be fine. if I remove that item the errors go away and if I add it again the errors come back. I have typed it in copy and pasted it. nothing works.
Previously, I had passed that section without a problem up until I added the onOptionSelection function. When I got an error there I worked my way back until the I emptied out the xml file and got no errors. when I added the items back to the xml file then I got errors. However this item can be added to the file with no erros:
<item android:id="#+id/action_settings"
android:title="#string/action_settings"
android:showAsAction="never" />
Anyone knows what may be cause this problem
Clean your project and try again. If it doesn't work, save, restart. If all else fails try checking this site http://blog.burnayev.com/2009/11/android-developer-tip-regenerating.html.
This issue is caused due to the R files not rendering.
restarting our android studio or java application help. You cant also try to sync project files with gradle file.
should be uder tools --> android --> sync project files with gradle file in your android studio.
Usually these kind of errors are indeed caused by an erroneous layout definition, but they are not the only one known issues, it could also be your Manifest file.
Your layout seems ok to me, but there's even the possibility they actually are but you need to clean your project (you'd need to select your Project in your WorkSpace view, and select Project -> Clean... within the menu. If this doesn't help, try closing/reopening Eclipse, and if this doesn't help, probably the best thing you can do is start over because as you're just starting with Android, there's something messed up with some attempts you might have done before.
I have had this issue in the past and I found out for some reason eclipse automatically added android.R to my imports. I just deleted it and cleaned my project and it fixed itself.
The layout editor is giving me StackOverflowErrors which ask me to exit eclipse everytime I load a layout XML.
this is clearly a bug, but does anyone know a workaround so I know what not to do? Unfortunately it's happening regardless of what layout I open.
I'm using Indigo with ADT v18
java.lang.StackOverflowError
at java.util.SubList$1.<init>(AbstractList.java:688)
at java.util.SubList.listIterator(AbstractList.java:687)
at java.util.AbstractList.listIterator(AbstractList.java:284)
at java.util.SubList.iterator(AbstractList.java:678)
at java.util.AbstractCollection.toArray(AbstractCollection.java:162)
at java.util.regex.Pattern.split(Pattern.java:1027)
at java.lang.String.split(String.java:2292)
at java.lang.String.split(String.java:2334)
at com.android.ide.common.resources.ResourceResolver.findResValue(ResourceResolver.java:206)
at com.android.ide.common.resources.ResourceResolver.resolveResValue(ResourceResolver.java:325)
at com.android.ide.common.resources.ResourceResolver.resolveResValue(ResourceResolver.java:333)
at com.android.ide.common.resources.ResourceResolver.resolveResValue(ResourceResolver.java:333)
at com.android.ide.common.resources.ResourceResolver.resolveResValue(ResourceResolver.java:333)
at com.android.ide.common.resources.ResourceResolver.resolveResValue(ResourceResolver.java:333)
There's an issue report here
http://code.google.com/p/android/issues/detail?id=24317
It appears to be an issue with resource referencing. No solution found so far but this reminds me that the problem happens after I changed the theme of the app. So I changed it back and it's allright now.
I had this problem when building at 4.0.3 with actionbarsherlock.
After my USB SSD disconnected with Eclipse open, I got a stack overflow every time I tried to open any xml layouts in my project. Initially I could get around it by either changing by build target back to 2.3.3 and eventually discovered removing the actionbarsherlock application theme stopped the crashes.
I found the fix was to remove the actionbarsherlock library and import a fresh version. This completely fixed the issue.
Since I updated two days ago my Android SDK to version API 14 I'm getting troubles using Eclipse Helios on my Windows 7 x64 laptop.
When I try to export a project everything is ok until I get to press the "finish" button: then a popup appears saying "aapt.exe has stopped working" and I can't get my signed apk; the project doesn't return errors and compiles as usual.
I googled to find a solution but nothing of the solutions i found worked:
I cleaned the project (Project>Clean)
I disabled the automatic build (Project>Build Automatically)
I deleted all the imported libraries (Right click on the project>Properties>Java Build Path)
I updated all the related software (Help>Check for updates)
I put logcat mode on verbose
I deleted my .9.png drawables and readded to my project
These are all the solutions I found related to aapt.exe issues. Do you have any other suggestion?
PS: I'm also getting a layout issue with all my .9.png files that are not displayed correctly, but I don't know if it's related.
I found a solution in Window>Preferences>Android>Build by setting "Build output" on Normal and then Project>Clean>Clean All.
I don't know if this is the definitive solution but it made me able to export my apk with the proper .9.png drawable layout.
Hope it helps.
I faced the same problem when I tried to add id as <resources> as mentioned here.
<resources>
<item type="id" name="button_ok" />
<item type="id" name="dialog_exit" />
</resources>
When I deleted this, the build was successful.
I had this same problem defining a menu item like this:
<item
android:id="#+id/menu_help"
android:showAsAction="never|withText"
android:title="#string/action_label_help"
android:icon="#drawable/ic_menu_help"
/>
I was just missing the icon file ic_menu_help, but instead of giving me a nice message that the image file was missing, it crashes aapt.