我做了一个应用程序,当我制作应用程序时,我在带有平台的AVD设备上测试它:2.2,它完美无缺。当我完成后,我在手机上用平台试了一下:4.2.2。然后它说;不幸的是[app name]已经停止了。我试图在很多不同的平台上运行应用程序,但它只适用于2.2。任何人都知道如何使应用程序与所有平台兼容?
继承我的LogCat详细错误:
10-26 19:49:39.364: E/Trace(36): error opening trace file: No such file or directory (2)
10-26 19:49:40.174: E/Trace(94): error opening trace file: No such file or directory (2)
10-26 19:49:49.414: W/Zygote(37): Class not found for preloading: libcore.icu.ErrorCode
10-26 19:50:12.974: E/SoundPool(294): error loading /system/media/audio/ui/Lock.ogg
10-26 19:50:12.974: E/SoundPool(294): error loading /system/media/audio/ui/Unlock.ogg
10-26 19:50:13.595: E/Trace(294): error opening trace file: No such file or directory (2)
10-26 19:50:17.964: E/Trace(355): error opening trace file: No such file or directory (2)
10-26 19:50:20.254: E/Trace(383): error opening trace file: No such file or directory (2)
10-26 19:50:20.304: E/Trace(398): error opening trace file: No such file or directory (2)
10-26 19:50:21.404: E/Trace(414): error opening trace file: No such file or directory (2)
10-26 19:50:24.334: E/Trace(439): error opening trace file: No such file or directory (2)
10-26 19:50:26.254: E/Trace(457): error opening trace file: No such file or directory (2)
10-26 19:50:33.884: E/Trace(493): error opening trace file: No such file or directory (2)
10-26 19:50:38.004: E/Trace(514): error opening trace file: No such file or directory (2)
10-26 19:50:41.554: E/SoundPool(294): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 19:50:41.554: E/SoundPool(294): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 19:50:41.554: E/SoundPool(294): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 19:50:41.554: E/SoundPool(294): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 19:50:41.554: E/SoundPool(294): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 19:50:41.566: E/SoundPool(294): error loading /system/media/audio/ui/KeypressStandard.ogg
10-26 19:50:41.566: E/SoundPool(294): error loading /system/media/audio/ui/KeypressSpacebar.ogg
10-26 19:50:41.566: E/SoundPool(294): error loading /system/media/audio/ui/KeypressDelete.ogg
10-26 19:50:41.566: E/SoundPool(294): error loading /system/media/audio/ui/KeypressReturn.ogg
10-26 19:50:41.566: W/AudioService(294): loadSoundEffects(), Error -1 while loading samples
10-26 19:50:42.364: E/Trace(534): error opening trace file: No such file or directory (2)
10-26 19:50:42.634: E/Trace(543): error opening trace file: No such file or directory (2)
10-26 19:50:49.246: E/Trace(585): error opening trace file: No such file or directory (2)
10-26 19:50:53.975: W/InputDispatcher(294): channel '4105f7a0 StatusBar (server)' ~ Consumer closed input channel or an error occurred. events=0x9
10-26 19:50:53.975: W/InputDispatcher(294): channel '41060b28 SearchPanel (server)' ~ Consumer closed input channel or an error occurred. events=0x9
10-26 19:50:53.984: W/InputDispatcher(294): channel '41030480 NavigationBar (server)' ~ Consumer closed input channel or an error occurred. events=0x9
10-26 19:50:55.655: E/Trace(612): error opening trace file: No such file or directory (2)
10-26 19:50:58.524: E/Trace(629): error opening trace file: No such file or directory (2)
10-26 19:51:01.645: E/Trace(653): error opening trace file: No such file or directory (2)
10-26 19:51:13.814: D/MmsSmsDatabaseHelper(398): [MmsSmsDb] tableName: threads hasAutoIncrement: CREATE TABLE threads (_id INTEGER PRIMARY KEY AUTOINCREMENT,date INTEGER DEFAULT 0,message_count INTEGER DEFAULT 0,recipient_ids TEXT,snippet TEXT,snippet_cs INTEGER DEFAULT 0,read INTEGER DEFAULT 1,type INTEGER DEFAULT 0,error INTEGER DEFAULT 0,has_attachment INTEGER DEFAULT 0) result: true
10-26 19:51:16.234: E/Trace(685): error opening trace file: No such file or directory (2)
10-26 19:51:19.874: E/Trace(706): error opening trace file: No such file or directory (2)
10-26 19:51:17.088: E/Trace(725): error opening trace file: No such file or directory (2)
10-26 19:51:20.598: W/MediaScanner(543): Error opening directory '/mnt/sdcard/', skipping: Permission denied.
10-26 19:51:24.918: E/Trace(759): error opening trace file: No such file or directory (2)
10-26 19:51:25.598: E/Trace(773): error opening trace file: No such file or directory (2)
10-26 19:51:26.558: E/Trace(786): error opening trace file: No such file or directory (2)
10-26 19:51:29.388: E/Trace(815): error opening trace file: No such file or directory (2)
10-26 19:51:38.068: E/AndroidRuntime(815): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.traczy2.clickcounter/com.traczy2.clickcounter.MainActivity}: android.view.InflateException: Binary XML file line #32: Error inflating class <unknown>
10-26 19:51:38.068: E/AndroidRuntime(815): Caused by: android.view.InflateException: Binary XML file line #32: Error inflating class <unknown>
10-26 19:51:38.068: E/AndroidRuntime(815): Caused by: java.lang.OutOfMemoryError
对于那些在activity_main.xml的第32行说出错的人,这就是
<Button
android:id="@+id/button4"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_alignLeft="@+id/button3"
android:layout_below="@+id/button3"
android:layout_marginTop="28dp"
android:background="@drawable/button4"
android:onClick="button4" />
“按钮”是第32行
10-26 22:29:12.389: E/Trace(36): error opening trace file: No such file or directory (2)
10-26 22:29:13.129: E/Trace(91): error opening trace file: No such file or directory (2)
10-26 22:29:22.729: W/Zygote(37): Class not found for preloading: libcore.icu.ErrorCode
10-26 22:29:49.909: E/SoundPool(289): error loading /system/media/audio/ui/Lock.ogg
10-26 22:29:49.929: E/SoundPool(289): error loading /system/media/audio/ui/Unlock.ogg
10-26 22:29:50.749: E/Trace(289): error opening trace file: No such file or directory (2)
10-26 22:29:55.379: E/Trace(347): error opening trace file: No such file or directory (2)
10-26 22:29:57.499: W/SocketClient(33): write error (Broken pipe)
10-26 22:29:58.749: E/Trace(387): error opening trace file: No such file or directory (2)
10-26 22:29:58.769: E/Trace(375): error opening trace file: No such file or directory (2)
10-26 22:29:59.569: E/Trace(405): error opening trace file: No such file or directory (2)
10-26 22:30:05.979: E/Trace(436): error opening trace file: No such file or directory (2)
10-26 22:30:06.369: E/Trace(447): error opening trace file: No such file or directory (2)
10-26 22:30:17.409: E/Trace(484): error opening trace file: No such file or directory (2)
10-26 22:30:21.589: E/SoundPool(289): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 22:30:21.589: E/SoundPool(289): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 22:30:21.599: E/SoundPool(289): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 22:30:21.599: E/SoundPool(289): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 22:30:21.609: E/SoundPool(289): error loading /system/media/audio/ui/Effect_Tick.ogg
10-26 22:30:21.609: E/SoundPool(289): error loading /system/media/audio/ui/KeypressStandard.ogg
10-26 22:30:21.609: E/SoundPool(289): error loading /system/media/audio/ui/KeypressSpacebar.ogg
10-26 22:30:21.609: E/SoundPool(289): error loading /system/media/audio/ui/KeypressDelete.ogg
10-26 22:30:21.699: E/SoundPool(289): error loading /system/media/audio/ui/KeypressReturn.ogg
10-26 22:30:21.699: W/AudioService(289): loadSoundEffects(), Error -1 while loading samples
10-26 22:30:23.809: E/Trace(517): error opening trace file: No such file or directory (2)
10-26 22:30:26.651: E/Trace(534): error opening trace file: No such file or directory (2)
10-26 22:30:27.019: E/Trace(546): error opening trace file: No such file or directory (2)
10-26 22:30:27.292: E/ActivityManager(289): 5% 509/Error dump: sys: 4.3% user + 0.7% kernel
10-26 22:30:32.558: E/Trace(571): error opening trace file: No such file or directory (2)
10-26 22:30:37.879: E/Trace(592): error opening trace file: No such file or directory (2)
10-26 22:30:44.129: E/Trace(622): error opening trace file: No such file or directory (2)
10-26 22:30:48.080: E/Trace(644): error opening trace file: No such file or directory (2)
10-26 22:30:54.929: E/Trace(665): error opening trace file: No such file or directory (2)
10-26 22:31:00.260: E/Trace(684): error opening trace file: No such file or directory (2)
10-26 22:31:00.843: E/Trace(700): error opening trace file: No such file or directory (2)
10-26 22:31:05.093: W/ActivityManager(289): No content provider found for permission revoke: file:///data/local/tmp/error.apk
10-26 22:31:07.254: D/MmsSmsDatabaseHelper(387): [MmsSmsDb] tableName: threads hasAutoIncrement: CREATE TABLE threads (_id INTEGER PRIMARY KEY AUTOINCREMENT,date INTEGER DEFAULT 0,message_count INTEGER DEFAULT 0,recipient_ids TEXT,snippet TEXT,snippet_cs INTEGER DEFAULT 0,read INTEGER DEFAULT 1,type INTEGER DEFAULT 0,error INTEGER DEFAULT 0,has_attachment INTEGER DEFAULT 0) result: true
10-26 22:31:10.045: W/MediaScanner(546): Error opening directory '/mnt/sdcard/', skipping: Permission denied.
10-26 22:31:10.344: W/ActivityManager(289): No content provider found for permission revoke: file:///data/local/tmp/error.apk
10-26 22:31:13.673: E/Trace(738): error opening trace file: No such file or directory (2)
10-26 22:31:14.473: E/Trace(753): error opening trace file: No such file or directory (2)
10-26 22:31:15.514: E/Trace(766): error opening trace file: No such file or directory (2)
10-26 22:31:17.983: E/Trace(795): error opening trace file: No such file or directory (2)
10-26 22:31:25.264: E/AndroidRuntime(795): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.traczy2.clickcounter/com.traczy2.clickcounter.MainActivity}: android.view.InflateException: Binary XML file line #41: Error inflating class <unknown>
10-26 22:31:25.264: E/AndroidRuntime(795): Caused by: android.view.InflateException: Binary XML file line #41: Error inflating class <unknown>
10-26 22:31:25.264: E/AndroidRuntime(795): Caused by: java.lang.OutOfMemoryError
After removing button 3 and 4
答案 0 :(得分:0)
目前尚不清楚问题是什么。 一个建议是使用试错法来调查Button标记中的哪些字段导致问题。
我会尝试删除引用button3
作为开头的行(所以android:layout_alignLeft
和android:layout_below
),如果这样做无效,请转到其他行。你确定button3是在你的XML文件的其他地方定义的吗?
如果这些都没有帮助,请尝试从XML中删除整个Button。如果您仍然看到相同的错误,那么问题可能会更加普遍。 (我知道,手动回答。)