This question already has answers here:
java - Android Studio - Unable to instantiate activity
(2 answers)
Reason for NullPointerException if setContentView() is not used
(3 answers)
Android App Runtime Error
(2 answers)
Android - Unable to instantiate activity - App has stopped
(1 answer)
Closed 13 days ago.
This post was edited and submitted for review 13 days ago and failed to reopen the post:
Original close reason(s) were not resolved
I'm building an app for a homework assignment here. The app keeps failing to launch because of an error. I know this is for an error that some others have experienced, but I can't understand how to apply it to my own, which is why I'm asking it here.
Here is the error:
AndroidRuntime: FATAL EXCEPTION: main
Process: wesfritz.c196, PID: 4260
java.lang.RuntimeException: Unable to start activity ComponentInfo{wesfritz.c196/wesfritz.c196.UI.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at wesfritz.c196.UI.MainActivity.onCreate(MainActivity.java:21)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Here's the MainActivity.java code:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//This is how buttons are set up in Android
Button button=this.findViewById(R.id.enterButton);
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, TermList.class);
//Intent is what connects functions together - makes a thing do a thing!
startActivity(intent);
}
});
setContentView(R.layout.activity_main);
}
Here is what the activity_main.xml looks like:
<TextView
android:id="#+id/textView"
android:layout_width="124dp"
android:layout_height="56dp"
android:fontFamily="sans-serif-condensed-medium"
android:text="StudentApp"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.578" />
<ImageView
android:id="#+id/imageView"
android:layout_width="156dp"
android:layout_height="150dp"
app:layout_constraintBottom_toTopOf="#+id/textView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.537"
app:srcCompat="#drawable/ic_launcher_foreground" />
<Button
android:id="#+id/enterButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter"
android:clickable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView" />
I've tried looking at other examples on here, but they're different and I haven't been able to figure out why mine won't launch. I thought it was because I have a method in a method, but the teacher wrote that code portion. I see that the line that has the problem is the "setOnClickListener" line, but I don't understand. Also, I think "enterButton" is correct across my XML and Java pieces. I'm kind of at a loss.
Related
I was learning how to take a grid and find some elements from the grid, but my app was crashing when I was looking to find the grid by id, so I decided to create a test app that would look for the grid right from the start and this app was crashing too. Note that at the testapp I introduced the legacy libraries to make sure that I don't miss something.
This is xml code for the view
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.264" />
<android.support.v7.widget.GridLayout
android:id="#+id/grid"
android:layout_width="409dp"
android:layout_height="354dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginTop="1dp"
app:columnCount="3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView"
app:rowCount="3">
</android.support.v7.widget.GridLayout>
</android.support.constraint.ConstraintLayout>
and this is the mainActivity the crash happens at the "GridLayout test" invocation
package com.example.test2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.GridLayout;
public class MainActivity extends AppCompatActivity {
GridLayout test =(GridLayout) findViewById(R.id.grid);
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
This is the Error message that I get
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.test2, PID: 11311
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.test2/com.example.test2.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
at android.support.v7.app.AppCompatDelegateImpl.<init>(AppCompatDelegateImpl.java:249)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:182)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:520)
at android.support.v7.app.AppCompatActivity.findViewById(AppCompatActivity.java:191)
at com.example.test2.MainActivity.<init>(MainActivity.java:9)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Any help on how to fix this issue would be appreciated and some detailed explanation why it happens , thank you .
You are trying to get id before activity knows about its xml layout. You need to put get id line in the onCreate method as below
public class MainActivity extends AppCompatActivity {
private GridLayout test;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
test =(GridLayout) findViewById(R.id.grid);
}
}
change your code from:
GridLayout test =(GridLayout) findViewById(R.id.grid);
to:
androidx.gridlayout.widget.GridLayout gridLayout = findViewById(R.id.gridLayout);
For Android Studio 4.0 and above,
use import androidx.gridlayout.widget.GridLayout
instead of import android.widget.GridLayout;
Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.widget.RelativeLayout.getBackground()' on a null object reference
I am creating an android app and want to have an animated background for it.
Unfortunatelly, I get this error here and I have no idea why it is so.
Here is the XML that I have:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/myLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/my_bg_animate"
tools:context=".AccessControlActivity">
<LinearLayout
..../>
<TextView
.... />
<ImageView
.... />
</RelativeLayout>
Here is the java file/class:
public class AccessControlActivity extends AppCompatActivity {
ConstraintLayout myLayout;
NfcAdapter nfcAdapter;
Button btnPositive, btnNegative;
Dialog epicDialog;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RelativeLayout relativeLayout = findViewById(R.id.myLayout);
AnimationDrawable animationDrawable = (AnimationDrawable) relativeLayout.getBackground();
animationDrawable.setEnterFadeDuration(4500);
animationDrawable.setExitFadeDuration(4500);
animationDrawable.start();
}
}
And that are the errors I see when I attempt to run the programm:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nfc.netvision/com.nfc.netvision.AccessControlActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.widget.RelativeLayout.getBackground()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.widget.RelativeLayout.getBackground()' on a null object reference
at com.nfc.netvision.AccessControlActivity.onCreate(AccessControlActivity.java:37)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Thank you in advance! Looking forward to some answers!
super.onCreate(savedInstanceState);
RelativeLayout relativeLayout = findViewById(R.id.myLayout);
After onCreate you didn't setContentView and directly executed findViewById because of that your RelativeLayout is null and running method of it causes exception.
You haven't defined the layout where you want to inflate the view on the onCreate method, write the next line after super.. :
setcontentview(R.layout.yourLayoutname);
I was looking everywhere but I couldn't find any solution for this error.
I'm using ExoPlayer for live video streaming. And my app crashes every time when I run it. If you can help me I will be happy.
I guess it should be somewhere in the XML file but I can't understand what means all that error.
XML:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.devbrackets.android.exomedia.ui.widget.VideoView
android:id="#+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:useDefaultControls="true"/>
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity file:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ProgressDialog progressDialog = new ProgressDialog(MainActivity.this);
progressDialog.setMessage("Please Wait");
progressDialog.setCancelable(false);
progressDialog.show();
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
videoView.setMediaController(mediaController);
videoView.setVideoURI(Uri.parse("Here's path"));
videoView.start();
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
#Override
public void onPrepared(MediaPlayer mp) {
progressDialog.dismiss();
}
});
}
}
Stacktrace:
Process: rusiptv.net, PID: 25782
java.lang.RuntimeException: Unable to start activity ComponentInfo{rusiptv.net/rusiptv.net.MainActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.devbrackets.android.exomedia.ui.widget.VideoView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at rusiptv.net.MainActivity.onCreate(MainActivity.java:42)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
If you can please explain to me more detailed about this error because if I will face this problem again then I can fix it easily.
Edit:
Guys thank you, everyone! I fixed this problem.
Solutions:
VideoView videoView = findViewById(R.id.video_view);
And I changed path for VideoView according to my packageName.
Please check whether
<com.devbrackets.android.exomedia.ui.widget.VideoView
android:id="#+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:useDefaultControls="true"/>
path for VideoView is correct according to your packageName.
As i check this file is not complete implement according to user's feedback please try another video view like this
<VideoView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="#+id/VideoView" />
You Must override the constructor
public VideoPlayerView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
This will solve your problem.
Make sure you add the library dependency and must be added this line
VideoView vedioView = findViewById(R.id.video_view);
Before use vedioView. I think it will solve your problem
This question already has answers here:
java.lang.IllegalArgumentException: This component requires that you specify a valid android:textAppearance attribute
(11 answers)
Error : IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents
(13 answers)
Closed 4 years ago.
I'm using an android studio with androidx in the latest version.
I have a TextInputLayout in my app, which makes the app crashes when adding any style to it!
this is my part of xml:
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="#style/Widget.MaterialComponents.TextInputLayout.FilledBox">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/saveNameID"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
and this is the logcat error:
2019-01-30 22:41:59.537 1980-1980/hossein.yusefpour.sinamobile E/AndroidRuntime: FATAL EXCEPTION: main
Process: hossein.yusefpour.sinamobile, PID: 1980
android.view.InflateException: Binary XML file line #51: Binary XML file line #51: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #51: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
.
.
.
at androidx.fragment.app.FragmentManagerImpl$1.run(FragmentManagerImpl.java:147)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:169)
at android.app.ActivityThread.main(ActivityThread.java:6578)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).
at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:240)
at com.google.android.material.internal.ThemeEnforcement.checkMaterialTheme(ThemeEnforcement.java:215)
We have an activity that uses the StreetViewPanoramaFragment to display the street for a particular property. Without any changes, we started receiving street view crashes. Has anybody encountered anything similar?
It is a very simple layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include layout="#layout/toolbar"
android:id="#+id/toolbar"/>
<fragment
android:id="#+id/streetview_fragment"
android:layout_below="#id/toolbar"
class="com.google.android.gms.maps.StreetViewPanoramaFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
The exception thrown is:
NullPointerException (#streetview.bg:a:39246) {main}
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.maps.api.android.lib6.gmm6.streetview.b.a()' on a null object reference at
com.google.maps.api.android.lib6.gmm6.streetview.bg.a(:com.google.android.gms.DynamiteModulesB:39246) at com.google.maps.api.android.lib6.gmm6.streetview.bg.onTouchEvent(:com.google.android.gms.DynamiteModulesB:30874) at
android.view.View.dispatchTouchEvent(View.java:9150) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2740) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1832) at android.app.Activity.dispatchTouchEvent(Activity.java:2944) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2701) at android.view.View.dispatchPointerEvent(View.java:9360) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4978) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4739) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4271) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4324) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4290) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4416) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4298) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4473) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4271) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4324) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4290) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4298) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4271) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6866) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6747) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6718) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6956) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:143) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:6837) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)