I'm testing my app with the new 1.6 SDK, and I ran into the error below. The InstantiationException doesn't give me much details. I'm wondering if anyone can give me a tip for how to debug this type of situation. Also, if someone could point me to the source for PhoneLayoutInflater I'd appreciate it.
Note: This application works well using the 1.5 SDK. I've tested the 1.5 SDK version a lot in preparation for the ADC2. This problem occurs on a 1.6 Platform, HVGA, API Level 4, Google APIs AVD. I'll describe the code a bit, and give the actual lines which are involved. First, I've sub-classed RelativeLayout. I've only dynamically added a view to the layout after inflation is complete. This RelativeLayout sub-class is used in a ListView. Here are the bits that actually do stuff: package com.flingtap.done; public CheckableRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); try{ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CheckableRelativeLayout, defStyle, 0); mRadioButtonResourceId = a.getResourceId (R.styleable.CheckableRelativeLayout_radioButton, 0); if( 0 == mRadioButtonResourceId ){ throw new RuntimeException("You must supply a radioButton attribute."); } a.recycle(); }catch(Exception exp){ Log.e(TAG, "ERR00019", exp); } } protected void onFinishInflate() { Log.v(TAG, "onFinishInflate() called"); super.onFinishInflate(); try{ View radioButtonView = findViewById(mRadioButtonResourceId); assert null != radioButtonView; mRadioButton = (RadioButton) radioButtonView; assert null != mRadioButton; setMinimumHeight(mRadioButton.getHeight()); }catch(Exception exp){ Log.e(TAG, "ERR0001A", exp); } } I've put a break point at the first line of both the CheckableRelativeLayout constructor and onFinishInflate method, but neither method seems to be reached. I instantiate this class from an XML layout like so: <com.flingtap.done.CheckableRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.flingtap.done" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:drawSelectorOnTop="false" app:radioButton="@+id/priority_options_list_item_radio_button" android:paddingLeft="6dip" android:paddingRight="6dip"> <resources> <declare-styleable name="CheckableRelativeLayout"> <attr name="radioButton" format="reference"/> </declare-styleable> .. I also added a Java exception breakpoint for InflateException and I get this stack: PhoneLayoutInflater(LayoutInflater).createView(String, String, AttributeSet) line: 516 PhoneLayoutInflater(LayoutInflater).createViewFromTag(String, AttributeSet) line: 564 PhoneLayoutInflater(LayoutInflater).inflate(XmlPullParser, ViewGroup, boolean) line: 385 ... I searched the GIT repository for the PhoneLayoutInflater, but could not find it. Anyone know where I can find the source for this PhoneLayoutInflater? Finally, here is the error: 09-21 00:41:58.154: DEBUG/AndroidRuntime(773): Shutting down VM 09-21 00:41:58.154: WARN/dalvikvm(773): threadid=3: thread exiting with uncaught exception (group=0x4001aa28) 09-21 00:41:58.234: ERROR/AndroidRuntime(773): Uncaught handler: thread main exiting due to uncaught exception 09-21 00:41:58.264: ERROR/AndroidRuntime(773): android.view.InflateException: Binary XML file line #7: Error inflating class java.lang.reflect.Constructor 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.LayoutInflater.createView(LayoutInflater.java:512) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:564) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at com.flingtap.done.LeanAdapter.newView(LeanAdapter.java:48) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at com.flingtap.done.LeanAdapter.getView(LeanAdapter.java:37) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.AbsListView.obtainView(AbsListView.java:1273) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.ListView.measureHeightOfChildren(ListView.java:1147) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.ListView.onMeasure(ListView.java:1060) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.View.measure(View.java:7703) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java: 888) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.LinearLayout.measureVertical(LinearLayout.java:350) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.View.measure(View.java:7703) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java: 888) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.LinearLayout.measureVertical(LinearLayout.java:350) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.View.measure(View.java:7703) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.View.measure(View.java:7703) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.View.measure(View.java:7703) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.ViewRoot.performTraversals(ViewRoot.java:747) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.ViewRoot.handleMessage(ViewRoot.java:1613) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.os.Handler.dispatchMessage(Handler.java:99) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.os.Looper.loop(Looper.java:123) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.app.ActivityThread.main(ActivityThread.java:4203) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at java.lang.reflect.Method.invokeNative(Native Method) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at java.lang.reflect.Method.invoke(Method.java:521) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:791) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at dalvik.system.NativeStart.main(Native Method) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): Caused by: java.lang.InstantiationException: com.flingtap.done.CheckableRelativeLayout 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at java.lang.reflect.Constructor.constructNative(Native Method) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): at android.view.LayoutInflater.createView(LayoutInflater.java:499) 09-21 00:41:58.264: ERROR/AndroidRuntime(773): ... 35 more 09-21 00:41:58.304: INFO/Process(580): Sending signal. PID: 773 SIG: 3 09-21 00:41:58.304: INFO/dalvikvm(773): threadid=7: reacting to signal 3 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---