How to get a specific line of code that caused an error

I get a java.lang.NullPointerException exception when the application starts and it disconnects. Emulator Error: "Unfortunately, appname has stopped." It worked fine until I wrote a bunch of new code and changed the manifest. I hope this is not a manifest, but my question is, how can I find out which line of code is the problem? A trace dump means nothing to me, and although it is verbose, having ... 11 more does not allow me to see all this.

I do not know what it means. I was looking for it, but there seems to be a list of things that this could mean. I tried Project> Clean, I tried messing around with the manifest again, but I still get the error. I checked / unchecked external libraries. Just did what people suggested doing for other people getting the same error. So I would really like to know in which line this was configured?

Here is the result, if that helps:

06-29 08:37:23.680: E/AndroidRuntime(1225): FATAL EXCEPTION: main
06-29 08:37:23.680: E/AndroidRuntime(1225): java.lang.RuntimeException: Unable to    instantiate activity      ComponentInfo{com.upliftly.android/com.upliftly.android.UpliftlyActivity}: java.lang.NullPointerException
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.app.ActivityThread.access$600(ActivityThread.java:122)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.os.Looper.loop(Looper.java:137)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.app.ActivityThread.main(ActivityThread.java:4340)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at java.lang.reflect.Method.invokeNative(Native Method)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at java.lang.reflect.Method.invoke(Method.java:511)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at dalvik.system.NativeStart.main(Native Method)
06-29 08:37:23.680: E/AndroidRuntime(1225): Caused by: java.lang.NullPointerException
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:101)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at com.upliftly.android.UpliftlyActivity.<init>(UpliftlyActivity.java:19)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at java.lang.Class.newInstanceImpl(Native Method)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at java.lang.Class.newInstance(Class.java:1319)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
06-29 08:37:23.680: E/AndroidRuntime(1225):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
06-29 08:37:23.680: E/AndroidRuntime(1225):     ... 11 more
+5
source share
4 answers

Usually, when you see a stack trace like the one you sent, you should focus on the lines after the last

Caused by: 

. , ( ) , . , ,

at com.upliftly.android.UpliftlyActivity.<init>(UpliftlyActivity.java:19)
+8

( , com.uplifty.android):

at com.upliftly.android.UpliftlyActivity.<init>(UpliftlyActivity.java:19)
+7

: , , :

at com.upliftly.android.UpliftlyActivity.<init>(UpliftlyActivity.java:19)

, Java . , UpliftlyActivity.java 19.

xml , , .

+1

In the logarithm, it will indicate the package name and the name of your activity line number. Then you need to notice that in this line which variables are available, then you need to check that the variables and its corresponding xml id. so with this you can avoid this error. i think in your hosted logcat

at com.upliftly.android.UpliftlyActivity.<init>(UpliftlyActivity.java:19)

the above line is apparently your line of activity in which you can check and fix the error.

0
source

All Articles