
App crashes without errors solved in Android studio
App crashes without errors solved in Android studio
In this video we will see how to solve App crashes without errors in Android studio
#AndroidStudio #AndroidStudioTutorials
Content
0.234 -> hello everyone in this video I am going to show you how to solve
3.649 -> my app crashes even though there is no error in android studio code
8.505 -> so its a common mistake thats done here , I wouldn't recommend that it works 100% I don't know
14.784 -> maybe the type of error could be different but this also one of the cases in that
20.19 -> so this one works for me
22.777 -> so I will tell you this one , currently I have a code
25.607 -> simple code , I have a button and textview over here
28.923 -> and just a simple one , if I press the button
31.739 -> the testview will change to "hello" , thats it pretty straightforward and it has a function
36.718 -> and here is the reference to it and thats it
41.297 -> thats the code , its very simple, the onc (onclick function) given it over here
45.696 -> onc in onclick
49.575 -> so now I have connected my mobile phone to it and let me just run it
58.146 -> I have already ran this program and you can see here
62.027 -> installed successfully finished , but in my phone the app has already crashed
67.624 -> so first lets get to the basics
71.074 -> if your app has crashed just don't go to any other website and type "my app has crashed , how to solve it", you can solve on your own , its very simple to solve it
81.663 -> so just go to logcat , run , todo , logcat will be there
86.879 -> and here just go to , it will be actually verbose I think so
91.466 -> it will show you multiple options , you are just going to select "error"
97.659 -> just select error and in this error
104.312 -> so you are just search for the link like thing ( blue color underlined text )
107.71 -> So I have only one error actually , thats because its a small program
111.968 -> so mainactivity.java 12
114.256 -> so this is mainactivity.java and it shows error in 12
118.588 -> so click it , it will directly take us to the line
121.518 -> so whats the error , I don't have any error here
125.481 -> but still its showing an error, actually there is an error in it
129.148 -> so I will solve it , pretty much simple
133.41 -> just going to cut it
136.099 -> and paste it inside this function thats it
140.553 -> so this is the error , I think many of you would have done this
145.041 -> and your app might have crashed , this is the error thats causing it to crash
151.232 -> so whenever you declare a textview
154.542 -> it must be declared within the function (or globally at the top) , when you have a public onclick call
160.591 -> if you have onclicklistener there is no problem , you can directly declare inside the class
164.485 -> so whenever you use onclick method you need to declare it
168.539 -> inside this (or have it globally declared at the top) , so now let me just run it again
180.986 -> so now my app has run successfully
184.42 -> so now let me show you again , going to logcat
187.302 -> so you see the logcat "error" , there is no error
191.222 -> and if you go to verbose also there is no red marks
194.791 -> so that shows your app has successfully run 100% , no errors nothing
199.254 -> so this is one of the ways , I am not saying this will work or be error for you
203.338 -> but this maybe thats what I am saying
206.166 -> and thanks for watching and for many such
208.901 -> tutorials , I have done on many things in python , unity , android studio so kindly watch that
213.935 -> and subscribe and support thank you
Source: https://www.youtube.com/watch?v=vX4rO-ShHWs