Hmm, I have an app that similarly uses a PreferenceActivity and build
target 1.6, but it runs fine on the 1.5 emulator. I wonder what we are
doing different.

Is your activity just the basic form like this?
public class Preferences extends PreferenceActivity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                addPreferencesFromResource(R.xml.preferences);
        }
}

Are you calling Preference#setLayoutResource in any way? Seems like
that could change the XML file being used. I think I found the default
one in the Android source, but don't see the missing attribute in it.

On Nov 3, 5:03 pm, "Armond Avanes" <armond...@yahoo.com> wrote:
> Hi Guys,
>
> I have an application which is based Android 1.5 but for enabling different
> screen types support I have to compile and package it with v1.6. When I
> install and run the resulted APK on my 1.5 emulator, everything works fine
> except that "Preferences" activity crashes every time I launch it!
>
> When I revert back my API dependency to 1.5 and remove a few 1.6 specific
> config blocks from AndroidManifest.xml and compile/package it with 1.5,
> everything works just fine!!
>
> Below is the exception I get when it crashes. I will highly appreciate any
> help on this:
>
> D/AndroidRuntime(  985): Shutting down VM
> W/dalvikvm(  985): threadid=3: thread exiting with uncaught exception
> (group=0x4000fe70)
> E/AndroidRuntime(  985): Uncaught handler: thread main exiting due to
> uncaught exception
> E/AndroidRuntime(  985): java.lang.RuntimeException: Binary XML file line
> #18: You must supply a layout_width attribute.
> E/AndroidRuntime(  985):        at
> android.content.res.TypedArray.getLayoutDimension(TypedArray.java:438)
> E/AndroidRuntime(  985):        at
> android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3319)
> E/AndroidRuntime(  985):        at
> android.view.ViewGroup$LayoutParams.<init>(ViewGroup.java:3274)
> E/AndroidRuntime(  985):        at
> android.widget.AbsListView$LayoutParams.<init>(AbsListView.java:3242)
> E/AndroidRuntime(  985):        at
> android.widget.AbsListView.generateLayoutParams(AbsListView.java:3123)
> E/AndroidRuntime(  985):        at
> android.widget.AbsListView.generateLayoutParams(AbsListView.java:69)
> E/AndroidRuntime(  985):        at
> android.view.LayoutInflater.inflate(LayoutInflater.java:395)
> E/AndroidRuntime(  985):        at
> android.view.LayoutInflater.inflate(LayoutInflater.java:320)
> E/AndroidRuntime(  985):        at
> android.preference.Preference.onCreateView(Preference.java:412)
> E/AndroidRuntime(  985):        at
> android.preference.Preference.getView(Preference.java:389)
> E/AndroidRuntime(  985):        at
> android.preference.PreferenceGroupAdapter.getView(PreferenceGroupAdapter.jav
> a:187)
> E/AndroidRuntime(  985):        at
> android.widget.AbsListView.obtainView(AbsListView.java:1269)
> E/AndroidRuntime(  985):        at
> android.widget.ListView.makeAndAddView(ListView.java:1623)
> E/AndroidRuntime(  985):        at
> android.widget.ListView.fillDown(ListView.java:607)
> E/AndroidRuntime(  985):        at
> android.widget.ListView.fillFromTop(ListView.java:664)
> E/AndroidRuntime(  985):        at
> android.widget.ListView.layoutChildren(ListView.java:1481)
> E/AndroidRuntime(  985):        at
> android.widget.AbsListView.onLayout(AbsListView.java:1113)
> E/AndroidRuntime(  985):        at android.view.View.layout(View.java:6133)
> E/AndroidRuntime(  985):        at
> android.widget.FrameLayout.onLayout(FrameLayout.java:333)
> E/AndroidRuntime(  985):        at android.view.View.layout(View.java:6133)
> E/AndroidRuntime(  985):        at
> android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
> E/AndroidRuntime(  985):        at
> android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
> E/AndroidRuntime(  985):        at
> android.widget.LinearLayout.onLayout(LinearLayout.java:918)
> E/AndroidRuntime(  985):        at android.view.View.layout(View.java:6133)
> E/AndroidRuntime(  985):        at
> android.widget.FrameLayout.onLayout(FrameLayout.java:333)
> E/AndroidRuntime(  985):        at android.view.View.layout(View.java:6133)
> E/AndroidRuntime(  985):        at
> android.view.ViewRoot.performTraversals(ViewRoot.java:929)
> E/AndroidRuntime(  985):        at
> android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
> E/AndroidRuntime(  985):        at
> android.os.Handler.dispatchMessage(Handler.java:99)
> E/AndroidRuntime(  985):        at android.os.Looper.loop(Looper.java:123)
> E/AndroidRuntime(  985):        at
> android.app.ActivityThread.main(ActivityThread.java:3948)
> E/AndroidRuntime(  985):        at
> java.lang.reflect.Method.invokeNative(Native Method)
> E/AndroidRuntime(  985):        at
> java.lang.reflect.Method.invoke(Method.java:521)
> E/AndroidRuntime(  985):        at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:7
> 82)
> E/AndroidRuntime(  985):        at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
> E/AndroidRuntime(  985):        at dalvik.system.NativeStart.main(Native
> Method)
>
> Best Regards,
> Armond

-- 
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

Reply via email to