So I had created an activity called BagActivity and it's adapter etc. and have since deleted it as it was no longer required. I clean built the project, uninstalled apk from test devices and yet, I get the following error:
FATAL EXCEPTION: main
Process: in.ddas.pretense, PID: 11858
java.lang.RuntimeException: Unable to start activity ComponentInfo{in.ddas.pretense/in.ddas.pretense.BagActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
at in.ddas.pretense.BagActivity.onCreate(BagActivity.java:28)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
What seems to be the problem?
Thanks.
EDIT: If I run this app in a different test device this error doesn't show! Why show it for 1 device?
It seems that you haven't deleted all BugActivity staff.
You have an exception:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
at in.ddas.pretense.BagActivity.onCreate(BagActivity.java:28)
It caused second exception. So it says that you try to work with null RecyclerView object in onCreate method of BagActivity. You may delete layout of BagActivity without deleting activity class.
Related
This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 4 years ago.
Now that i finally got Firebase connected im having a Problem with The Authentification. Its a NullpointerException in Line 47 but i dont get why, maybe im just overlooking something or i cannot find the issue
Stacktrace:
05-14 20:57:52.413 8315-8315/com.github.compete E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.github.compete, PID: 8315
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.github.compete/com.github.compete.MainActivityMenu}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2442)
at android.app.ActivityThread.access$800(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5389)
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:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at com.github.compete.MainActivityMenu.onCreate(MainActivityMenu.java:47)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2332)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2442)
at android.app.ActivityThread.access$800(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1351)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5389)
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:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
Code in Line 47:findViewById(R.id.nav_camera).setOnClickListener(this);
I dont see the problem, maybe i should stop for today.
-Thanks
There is no view having as id nav_camera in your view.
The logcat message shows this:
12-05 19:24:09.406 28495-28495/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.user.fragment, PID: 28495
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.user.fragment/com.example.user.fragment.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:2659)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
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 com.example.user.fragment.MainActivity.onCreate(MainActivity.java:25)
at android.app.Activity.performCreate(Activity.java:6672)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
The app has suddenly stopped working. What could be the possible error?
You have button defined in Activity file, and you are accessing layout button but which is actually not there. Please check at your end.
Suddently, during regular usage of my Nexus 5, the Google Play Store started crashing every time I try to open it.
So, I tried to get the log of the error, here it is:
11664-11664/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.android.vending, PID: 11664
java.lang.RuntimeException: Unable to create application com.google.android.finsky.FinskyApp: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
at android.app.ActivityThread.handleBindApplication(<Xposed>)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference
at android.os.Parcel.readException(Parcel.java:1605)
at android.os.Parcel.readException(Parcel.java:1552)
at android.content.pm.IPackageInstaller$Stub$Proxy.getMySessions(IPackageInstaller.java:385)
at android.content.pm.PackageInstaller.getMySessions(PackageInstaller.java:415)
at com.google.android.finsky.installer.PackageInstallerImpl.<init>(PackageInstallerImpl.java:71)
at com.google.android.finsky.installer.PackageInstallerFactory.init(PackageInstallerFactory.java:23)
at com.google.android.finsky.FinskyApp.onCreate(FinskyApp.java:387)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
at android.app.ActivityThread.handleBindApplication(<Xposed>)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102) `
I tried to look for this error online, but couldn't find anything. I assume it's related to some system app that has one of her permissions unapproved (I don't know which could be the one), or maybe related to my Xposed Framework installation.
What could it be?
Thank you for your help.
its not any other problem did you see Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference. you have calling some null object reference.
So I was able to successfully create a main popup that calls other popups. I got the first popup to work great but for some reason the second popup isn't working. I copied and pasted the first one over and it worked great. I then added all of my code minus the xml doc and it worked again. Finally when I changed the layout it doesn't work =/. Not sure where else to look or try. Here is the layout call and the error code. Thanks!
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.arrestee_popup);
Here are the logs
03-18 15:48:24.353 18979-18979/com.f0xcr4f7.intelwatch E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.f0xcr4f7.intelwatch, PID: 18979
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.f0xcr4f7.intelwatch/com.f0xcr4f7.intelwatch.ArresteePop}: 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:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
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 com.f0xcr4f7.intelwatch.ArresteePop.onCreate(ArresteePop.java:89)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
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:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
when I changed the layout it doesn't work
Because findViewById(R.id.your_button) will return null if you didn't include #+id/your_button into arrestee_popup.xml.
And consequently, yourButton.setOnClickListener throws a NullPointerException
It was an error with my save and cancel buttons in the arrestee class.. The error made it seem like it was in the xml which was miss leading =/.
cancelArrestee_Button = (Button) findViewById(R.id.bCancelArrestee);
saveArrestee_Button = (Button) findViewById(R.id.bSaveArrestee);
I am receiving these crash reports from my crash reporting tools.
I don't which code to provide here so just let me know if you want to see any particular code.
I haven't put anything related to GoogleAnalytics in onStart method as it is not mentioned in documentation.
Fatal Exception: java.lang.RuntimeException Unable to start service
com.google.android.gms.analytics.AnalyticsService#3399b37 with null:
java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String android.content.Intent.getAction()' on a null object
reference
java.lang.RuntimeException: Unable to start service
com.google.android.gms.analytics.AnalyticsService#3399b37 with null:
java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String android.content.Intent.getAction()' on a null object
reference
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2910)
at android.app.ActivityThread.access$2200(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) Caused by: java.lang.NullPointerException: Attempt to invoke virtual
method 'java.lang.String android.content.Intent.getAction()' on a null
object reference
at com.google.android.gms.analytics.AnalyticsService.onStartCommand()
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2893)
at android.app.ActivityThread.access$2200(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
This is a reported bug with the Google Analytics: https://code.google.com/p/analytics-issues/issues/detail?id=667.