I recently decided to try Android Studio after being a while on Eclipse. My main activity xml rendered okay on Eclipse but Studio seems to have a problem with it. It reports this on the Preview window: Rendering Problems java.lang.StackOverflowError Copy stack to clipboard.
Part of the contents (full is > 70K characters) of the clipboard is:
java.lang.StackOverflowError
at com.android.tools.idea.rendering.ProjectCallback.loadView(ProjectCallback.java:153)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:782)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:745)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
The actual xml code is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:id="@+id/currentPosition"
style="@style/ScreenFont_Normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#F7F7E6"
android:textColor="#8B8B8B"
android:text="@string/curr_loca" />
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/currentPosition"
class="com.google.android.gms.maps.SupportMapFragment"
tools:layout="@layout/activity_main"/>
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
Although this does not affect the build and creation of the .apk file I would still like to take advantage of the cool graphical UI editing features of Studio.
Any help would be greatly appreciated
Cheers
Remove the following line from the XML inside your fragment:
tools:layout="@layout/activity_main"/>
Reason: In Android Studio, you're presented with an option to edit separate layouts when working with an XML document containing a fragment. Upon selecting the option to edit the parent layout, this line above is inserted into the code. Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With