0

好的,下面是我尝试运行应用程序时生成的日志。应用程序意外失败,甚至无法启动

09-02 04:28:51.856: D/dalvikvm(781): GC_FOR_ALLOC freed 66K, 7% free 2542K/2728K, paused 51ms, total 66ms
09-02 04:28:51.866: I/dalvikvm-heap(781): Grow heap (frag case) to 3.181MB for 614500-byte allocation
09-02 04:28:51.936: D/dalvikvm(781): GC_FOR_ALLOC freed <1K, 6% free 3142K/3332K, paused 67ms, total 67ms
09-02 04:28:52.406: W/SoundPool(781):   sample 1 not READY
09-02 04:28:53.116: D/gralloc_goldfish(781): Emulator without GPU emulation detected.
09-02 04:28:53.376: I/Choreographer(781): Skipped 33 frames!  The application may be doing too much work on its main thread.
09-02 04:29:22.606: E/AudioTrack(781): Could not get audio output for stream type 3
09-02 04:29:22.606: E/SoundPool(781): Error creating AudioTrack
09-02 04:29:22.756: D/dalvikvm(781): GC_FOR_ALLOC freed 30K, 5% free 3523K/3672K, paused 19ms, total 21ms
09-02 04:29:22.756: I/dalvikvm-heap(781): Grow heap (frag case) to 4.159MB for 635812-byte allocation
09-02 04:29:22.856: D/dalvikvm(781): GC_FOR_ALLOC freed 1K, 4% free 4143K/4296K, paused 97ms, total 97ms
09-02 04:29:22.966: I/Choreographer(781): Skipped 91 frames!  The application may be doing too much work on its main thread.
09-02 04:29:23.206: I/Choreographer(781): Skipped 55 frames!  The application may be doing too much work on its main thread.
09-02 04:29:23.375: I/Choreographer(781): Skipped 35 frames!  The application may be doing too much work on its main thread.
09-02 04:29:23.776: I/Choreographer(781): Skipped 79 frames!  The application may be doing too much work on its main thread.
09-02 04:29:28.016: D/dalvikvm(781): GC_FOR_ALLOC freed 108K, 5% free 4436K/4664K, paused 111ms, total 133ms
09-02 04:29:28.045: I/dalvikvm-heap(781): Grow heap (frag case) to 5.030MB for 614500-byte allocation
09-02 04:29:28.096: D/dalvikvm(781): GC_FOR_ALLOC freed 1K, 5% free 5034K/5268K, paused 55ms, total 56ms
09-02 04:29:28.235: W/SoundPool(781):   sample 1 not READY
09-02 04:29:28.785: I/Choreographer(781): Skipped 50 frames!  The application may be doing too much work on its main thread.
09-02 04:29:31.626: E/AudioTrack(781): Could not get audio output for stream type 3
09-02 04:29:31.626: E/SoundPool(781): Error creating AudioTrack
09-02 04:29:31.746: E/SlaveBlueTooth(781): +++ ON CREATE +++
09-02 04:29:31.766: W/System.err(781): java.io.IOException: open failed: EROFS (Read-only file system)
09-02 04:29:31.776: W/System.err(781):  at java.io.File.createNewFile(File.java:948)
09-02 04:29:31.785: W/System.err(781):  at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)
09-02 04:29:31.796: W/System.err(781):  at android.app.Activity.performCreate(Activity.java:5133)
09-02 04:29:31.796: W/System.err(781):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-02 04:29:31.796: W/System.err(781):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-02 04:29:31.816: W/System.err(781):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-02 04:29:31.816: W/System.err(781):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-02 04:29:31.816: W/System.err(781):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-02 04:29:31.826: W/System.err(781):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 04:29:31.826: W/System.err(781):  at android.os.Looper.loop(Looper.java:137)
09-02 04:29:31.826: W/System.err(781):  at android.app.ActivityThread.main(ActivityThread.java:5103)
09-02 04:29:31.836: W/System.err(781):  at java.lang.reflect.Method.invokeNative(Native Method)
09-02 04:29:31.836: W/System.err(781):  at java.lang.reflect.Method.invoke(Method.java:525)
09-02 04:29:31.846: W/System.err(781):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-02 04:29:31.846: W/System.err(781):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-02 04:29:31.856: W/System.err(781):  at dalvik.system.NativeStart.main(Native Method)
09-02 04:29:31.856: W/System.err(781): Caused by: libcore.io.ErrnoException: open failed: EROFS (Read-only file system)
09-02 04:29:31.876: W/System.err(781):  at libcore.io.Posix.open(Native Method)
09-02 04:29:31.886: W/System.err(781):  at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
09-02 04:29:31.886: W/System.err(781):  at java.io.File.createNewFile(File.java:941)
09-02 04:29:31.896: W/System.err(781):  ... 15 more
09-02 04:29:32.016: D/AndroidRuntime(781): Shutting down VM
09-02 04:29:32.016: W/dalvikvm(781): threadid=1: thread exiting with uncaught exception (group=0x41465700)
09-02 04:29:32.066: E/AndroidRuntime(781): FATAL EXCEPTION: main
09-02 04:29:32.066: E/AndroidRuntime(781): java.lang.RuntimeException: Unable to start activity ComponentInfo{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.BTSmartSlavemodule}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.os.Looper.loop(Looper.java:137)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.ActivityThread.main(ActivityThread.java:5103)
09-02 04:29:32.066: E/AndroidRuntime(781):  at java.lang.reflect.Method.invokeNative(Native Method)
09-02 04:29:32.066: E/AndroidRuntime(781):  at java.lang.reflect.Method.invoke(Method.java:525)
09-02 04:29:32.066: E/AndroidRuntime(781):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-02 04:29:32.066: E/AndroidRuntime(781):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-02 04:29:32.066: E/AndroidRuntime(781):  at dalvik.system.NativeStart.main(Native Method)
09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781):  at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:226)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.Activity.requestWindowFeature(Activity.java:3264)
09-02 04:29:32.066: E/AndroidRuntime(781):  at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:141)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.Activity.performCreate(Activity.java:5133)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-02 04:29:32.066: E/AndroidRuntime(781):  ... 11 more
4

5 回答 5

0

这里有多个问题:

09-02 04:29:31.766: W/System.err(781): java.io.IOException: open failed: EROFS (Read-only file system)
09-02 04:29:31.776: W/System.err(781):  at java.io.File.createNewFile(File.java:948)
09-02 04:29:31.785: W/System.err(781):  at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)

BTSmartSlavemodule.java第 118 行,您尝试在只读文件系统上创建一个新文件。

09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
09-02 04:29:32.066: E/AndroidRuntime(781):  at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:226)
09-02 04:29:32.066: E/AndroidRuntime(781):  at android.app.Activity.requestWindowFeature(Activity.java:3264)
09-02 04:29:32.066: E/AndroidRuntime(781):  at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:141)

在您尝试调用的同一文件的第 141 行requestWindowFeature()调用setContentView(). 您需要先设置窗口功能setContentView()

于 2013-09-02T08:47:33.190 回答
0

您调用 requestFeature() 的位置不正确...尝试在此之前调用此方法setContentView(R.layout.activity)

于 2013-09-02T08:47:55.727 回答
0

此错误的原因是:

09-02 04:29:32.066: E/AndroidRuntime(781): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content

这个原因发生在:

09-02 04:29:31.785: W/System.err(781):  at helog.diwesh.NugaBest.BTSmartSlavemodule.onCreate(BTSmartSlavemodule.java:118)

你把代码放在哪里。requestWindowFeature(). 为避免这种情况,您必须将此代码放在前面setContentView(R.layout.your_layout);

于 2013-09-02T08:52:07.000 回答
0

我认为您正在尝试在 sdcard 上创建文件,但您没有指定权限在清单文件中写入外部存储

将此行添加到 manifest.xml 文件

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
于 2013-09-02T08:52:59.563 回答
0

这是您的 LogCat 的错误:

 FATAL EXCEPTION: main
09-02 04:29:32.066: E/AndroidRuntime(781): java.lang.RuntimeException: Unable to start activity ComponentInfo{hellog.diwesh.NugaBest/helog.diwesh.NugaBest.BTSmartSlavemodule}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
于 2013-09-02T08:45:21.303 回答