Reputation: 2517
Sorry guys for the newbie questions. I'm new to android, was working to set some login system in new application. Everything worked fine (after a long while), i had a login button from the menu in the main page which was just an empty "hello world" default activity. Then I decided to remove the "hello world" text view, i tried to run it immediately and the application crashed with null exception. I was doing ctrl+z like crazy but the application keeps on crashing. i understand absolutely nothing from the LogCat:
10-24 00:10:17.982: I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.application.mySoSpecialApplication/.MainActivity } 10-24 00:10:18.002: W/WindowManager(59): HistoryRecord{4505f618 com.application.mySoSpecialApplication/.MainActivity} failed creating starting window 10-24 00:10:18.002: W/WindowManager(59): java.lang.RuntimeException: Binary XML file line #25: You must supply a layout_height attribute. 10-24 00:10:18.002: W/WindowManager(59): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491) 10-24 00:10:18.002: W/WindowManager(59): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3593) 10-24 00:10:18.002: W/WindowManager(59): at android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:3672) 10-24 00:10:18.002: W/WindowManager(59): at android.widget.LinearLayout$LayoutParams.(LinearLayout.java:1395) 10-24 00:10:18.002: W/WindowManager(59): at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1321) 10-24 00:10:18.002: W/WindowManager(59): at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:45) 10-24 00:10:18.002: W/WindowManager(59): at android.view.LayoutInflater.rInflate(LayoutInflater.java:620) 10-24 00:10:18.002: W/WindowManager(59): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 10-24 00:10:18.002: W/WindowManager(59): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 10-24 00:10:18.002: W/WindowManager(59): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 10-24 00:10:18.002: W/WindowManager(59): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2165) 10-24 00:10:18.002: W/WindowManager(59): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2220) 10-24 00:10:18.002: W/WindowManager(59): at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1407) 10-24 00:10:18.002: W/WindowManager(59): at com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:894) 10-24 00:10:18.002: W/WindowManager(59): at com.android.server.WindowManagerService$H.handleMessage(WindowManagerService.java:9007) 10-24 00:10:18.002: W/WindowManager(59): at android.os.Handler.dispatchMessage(Handler.java:99) 10-24 00:10:18.002: W/WindowManager(59): at android.os.Looper.loop(Looper.java:123) 10-24 00:10:18.002: W/WindowManager(59): at com.android.server.WindowManagerService$WMThread.run(WindowManagerService.java:570) 10-24 00:10:18.042: I/ActivityManager(59): Start proc com.application.mySoSpecialApplication for activity com.application.mySoSpecialApplication/.MainActivity: pid=463 uid=10036 gids={3003} 10-24 00:10:18.272: D/AndroidRuntime(463): Shutting down VM 10-24 00:10:18.272: W/dalvikvm(463): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 10-24 00:10:18.292: E/AndroidRuntime(463): FATAL EXCEPTION: main 10-24 00:10:18.292: E/AndroidRuntime(463): java.lang.RuntimeException: Unable to instantiate application com.application.mySoSpecialApplication.mySoSpecialApplicationApplication: java.lang.NullPointerException 10-24 00:10:18.292: E/AndroidRuntime(463): at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:649) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4232) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.app.ActivityThread.access$3000(ActivityThread.java:125) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.os.Handler.dispatchMessage(Handler.java:99) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.os.Looper.loop(Looper.java:123) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-24 00:10:18.292: E/AndroidRuntime(463): at java.lang.reflect.Method.invokeNative(Native Method) 10-24 00:10:18.292: E/AndroidRuntime(463): at java.lang.reflect.Method.invoke(Method.java:521) 10-24 00:10:18.292: E/AndroidRuntime(463): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 10-24 00:10:18.292: E/AndroidRuntime(463): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 10-24 00:10:18.292: E/AndroidRuntime(463): at dalvik.system.NativeStart.main(Native Method) 10-24 00:10:18.292: E/AndroidRuntime(463): Caused by: java.lang.NullPointerException 10-24 00:10:18.292: E/AndroidRuntime(463): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:90) 10-24 00:10:18.292: E/AndroidRuntime(463): at com.application.mySoSpecialApplication.mySoSpecialApplicationApplication.(mySoSpecialApplicationApplication.java:14) 10-24 00:10:18.292: E/AndroidRuntime(463): at java.lang.Class.newInstanceImpl(Native Method) 10-24 00:10:18.292: E/AndroidRuntime(463): at java.lang.Class.newInstance(Class.java:1429) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.app.Instrumentation.newApplication(Instrumentation.java:957) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.app.Instrumentation.newApplication(Instrumentation.java:942) 10-24 00:10:18.292: E/AndroidRuntime(463): at android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:644) 10-24 00:10:18.292: E/AndroidRuntime(463): ... 11 more 10-24 00:10:18.312: W/ActivityManager(59): Force finishing activity com.application.mySoSpecialApplication/.MainActivity 10-24 00:10:18.968: W/ActivityManager(59): Activity pause timeout for HistoryRecord{4505f618 com.application.mySoSpecialApplication/.MainActivity} 10-24 00:10:21.322: I/Process(463): Sending signal. PID: 463 SIG: 9 10-24 00:10:21.352: I/ActivityManager(59): Process com.application.mySoSpecialApplication (pid 463) has died. 10-24 00:10:21.383: W/InputManagerService(59): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44fc1780 10-24 00:10:29.087: W/ActivityManager(59): Activity destroy timeout for HistoryRecord{4505f618 com.application.mySoSpecialApplication/.MainActivity}
Maybe one of you guys will figure out where is the problem. Thank you very much.
Upvotes: 0
Views: 1955
Reputation: 693
Incase of runtime error, look for word Caused by: in your logcat. This will help you to locate error easily.
Here in your case- look at logCat below...
00:10:18.292: E/AndroidRuntime(463): Caused by: java.lang.NullPointerException
10-24 00:10:18.292: E/AndroidRuntime(463): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:90)
10-24 00:10:18.292: E/AndroidRuntime(463): at com.application.mySoSpecialApplication.mySoSpecialApplicationApplication.(mySoSpecialApplicationApplication.java:14)
Ypu will find that run time error caused by getContentResolver at line 14 of (mySoSpecialApplicationApplication.java:14)
So here you located the error successfully.
After that look at the explanation by yugidroid This will help you.
I guess you're missing an atribute you should have defined to some View. So, to the XML layout inflated (the one you inflate when setConentView(R.layout.this_one) somewhere on the onCreate() method, I guess) just check if is missing the android:layout_height="wrap_content". If so, please add it. This should resolve you issue. Binary XML file line #25: You must supply a layout_height attribute.
Upvotes: 0
Reputation: 6690
I guess you're missing an atribute you should have defined to some View
.
So, to the XML layout inflated (the one you inflate when setConentView(R.layout.this_one)
somewhere on the onCreate()
method, I guess) just check if is missing the android:layout_height="wrap_content"
. If so, please add it. This should resolve you issue.
Binary XML file line #25: You must supply a layout_height attribute.
Upvotes: 1
Reputation: 49976
here is something interesting:
W/WindowManager(59): java.lang.RuntimeException: Binary XML file line #25: You must supply a layout_height attribute. 1
you must specify layout_height in your layout views, its mandatory
Upvotes: 2