I am trying to add separate portrait-landscape layouts to an older project of mine (basically I display 2 Fragments
: one with a google-map and the other one contains some OpenGL drawings). I created a layout resource folder named layout-land
that includes my landscape layout and I get an error in Android Studio:
Error:Execution failed for task ':MapDemoActivity:mergeDebugResources'.
> java.lang.NullPointerException (no error message)
in my Gradle Console:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':MapDemoActivity:mergeDebugResources'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option
to get more log output.
I am a beginner and I don't know how to Run with --stacktrace option to get the stack trace
or anything similar.
here's my portrait layout (activity_main.XML
) that works fine when I don't have the layout-land
folder:
<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"
android:animateLayoutChanges="true"
>
<fragment
android:id="@+id/map"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="350dp"
android:layout_alignParentBottom="true"/>
<fragment
android:id="@+id/openGL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.example.mapdemo.OpenGLES20ActivityFrag"
android:layout_above="@id/map"/>
</RelativeLayout>
the layout with the same name in my layout-land
folder (when I add this folder I get the above-mentioned error, I tried with a simple HelloWorld-style layout and it still didn't work so I don't think it has anything to do with what it contains):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:animateLayoutChanges="true"
android:baselineAligned="false"
android:orientation="horizontal"
tools:context=".MainActivity">
<fragment
android:id="@+id/map"
android:layout_width="400dp"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
<fragment
android:id="@+id/openGL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.example.mapdemo.OpenGLES20ActivityFrag" />
</LinearLayout>
If aditional code is required I will post it, however I don't think it is necesary. I do have the latest SDK and IDE versions.
I think if could just find out where the NullPointerException
error is in my code, I could solve it, but I don't know how to find it