我在模拟器(版本 2.2)上运行我的 android 应用程序,它工作正常。但是,当我在我的 android 设备(4.1 版)上尝试该应用程序时,它不起作用。我在日志中收到如下错误:
12-27 16:54:22.080: E/Trace(25485): error opening trace file: No such file or directory (2)
12-27 16:54:22.845: E/AndroidRuntime(25485): FATAL EXCEPTION: main
12-27 16:54:22.845: E/AndroidRuntime(25485): java.lang.RuntimeException: Binary XML file line #73: You must supply a layout_width attribute.
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5696)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:5832)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.RelativeLayout$LayoutParams.<init>(RelativeLayout.java:1099)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:956)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.RelativeLayout.generateLayoutParams(RelativeLayout.java:70)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.LayoutInflater.rInflate(LayoutInflater.java:748)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.ResourceCursorAdapter.newView(ResourceCursorAdapter.java:104)
12-27 16:54:22.845: E/AndroidRuntime(25485): at example.smartdialup.PhoneSpellDialer$ContactListAdapter.newView(PhoneSpellDialer.java:720)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.CursorAdapter.getView(CursorAdapter.java:246)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.AbsListView.obtainView(AbsListView.java:2457)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.ListView.makeAndAddView(ListView.java:1775)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.ListView.fillDown(ListView.java:678)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.ListView.fillFromTop(ListView.java:739)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.ListView.layoutChildren(ListView.java:1614)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.AbsListView.onLayout(AbsListView.java:2292)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.View.layout(View.java:14055)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewGroup.layout(ViewGroup.java:4602)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:948)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.View.layout(View.java:14055)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewGroup.layout(ViewGroup.java:4602)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.View.layout(View.java:14055)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewGroup.layout(ViewGroup.java:4602)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.View.layout(View.java:14055)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewGroup.layout(ViewGroup.java:4602)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.View.layout(View.java:14055)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewGroup.layout(ViewGroup.java:4602)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1990)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1811)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1110)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4470)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.Choreographer.doFrame(Choreographer.java:525)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.os.Handler.handleCallback(Handler.java:615)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.os.Handler.dispatchMessage(Handler.java:92)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.os.Looper.loop(Looper.java:137)
12-27 16:54:22.845: E/AndroidRuntime(25485): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-27 16:54:22.845: E/AndroidRuntime(25485): at java.lang.reflect.Method.invokeNative(Native Method)
12-27 16:54:22.845: E/AndroidRuntime(25485): at java.lang.reflect.Method.invoke(Method.java:511)
12-27 16:54:22.845: E/AndroidRuntime(25485): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-27 16:54:22.845: E/AndroidRuntime(25485): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-27 16:54:22.845: E/AndroidRuntime(25485): at dalvik.system.NativeStart.main(Native Method)
这是我的 Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="example.smartdialup"
android:versionName="1.81" android:versionCode="14">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".PhoneSpellDialer"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.CALL_BUTTON"/>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Preferences"></activity>
</application>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- <uses-sdk android:minSdkVersion="3"></uses-sdk>-->
<supports-screens
android:anyDensity="true" />
</manifest>
您知道如何在我的设备上成功运行该应用程序吗?