Android应用程序意外停止在模拟器中

时间:2015-09-03 04:32:05

标签: android

我尝试在模拟器上运行我的应用程序,并在设置断点时收到以下错误消息:

Exception is equal to  {ErrnoException@3591} 
       errno is equal to 2
   functionName is equal to {String@3602} "stat"
cause is equal to  {ErrnoException@3591} "android.system.ErrnoException: stat failed: ENOENT (No such file or directory)"

我的清单代码

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="divya.love.prasanth.bow" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name=".SampleApplication">

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="AIzaSyCNCJ2SVopyUeCZosW7xtT-464MT-QA-rA  "/>

<activity
    android:name=".MainActivity"
    android:label="@string/app_name" >
</activity>

<activity android:name=".DispatchActivity"
    android:label="BOW">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

<activity android:name=".LoginActivity" />
<activity android:name=".SignUpActivity" />
<activity android:name=".SignUpOrLoginActivity" />
</application>

</manifest>

这是我的logcat

09-03 10:46:45.906  16695-16695/? I/art﹕ Not late-enabling -Xcheck:jni              (already on)
09-03 10:46:46.277  16695-16714/divya.love.prasanth.bow D/OpenGLRenderer﹕ Use   EGL_SWAP_BEHAVIOR_PRESERVED: true
09-03 10:46:46.279  16695-16695/divya.love.prasanth.bow D/﹕  HostConnection::get() New Host Connection established 0xb42e7fd0, tid 16695
09-03 10:46:46.290  16695-16695/divya.love.prasanth.bow D/Atlas﹕ Validating map...
09-03 10:46:46.374  16695-16714/divya.love.prasanth.bow D/﹕ HostConnection::get() New Host Connection established 0xb43f41a0, tid 16714
09-03 10:46:46.402  16695-16714/divya.love.prasanth.bow I/OpenGLRenderer﹕ Initialized EGL, version 1.4
09-03 10:46:46.434  16695-16714/divya.love.prasanth.bow D/OpenGLRenderer﹕ Enabling debug mode 0
09-03 10:46:46.487  16695-16714/divya.love.prasanth.bow W/EGL_emulation﹕ eglSurfaceAttrib not implemented
09-03 10:46:46.490  16695-16714/divya.love.prasanth.bow W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xb43fc060, error=EGL_SUCCESS
09-03 10:46:46.631  16695-16695/divya.love.prasanth.bow D/AndroidRuntime﹕ Shutting down VM
09-03 10:46:46.633  16695-16695/divya.love.prasanth.bow E/AndroidRuntime﹕  FATAL EXCEPTION: main
Process: divya.love.prasanth.bow, PID: 16695
java.lang.RuntimeException: Unable to start activity     
ComponentInfo{divya.love.prasanth.bow/divya.love.prasanth.bow.MainActivity}:         java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or    descendant)
with this activity.           
at            android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
        at android.app.ActivityThread.access$800(ActivityThread.java:151)
at    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at    android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
 Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat    theme (or descendant) with this activity.
at    android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBas      e.java:124)
at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.ja    va:146)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
at divya.love.prasanth.bow.MainActivity.onCreate(MainActivity.java:15)
at android.app.Activity.performCreate(Activity.java:5990)
at   android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
09-03 10:46:46.767  16695-16707/divya.love.prasanth.bow I/art﹕ Background  
partial concurrent mark sweep GC freed 492(104KB) AllocSpace objects, 0(0B) LOS objects, 50% free, 1007KB/2031KB, paused 2.046ms total 158.306ms

有人可以告诉我发生了什么以及如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我认为您的活动会扩展导致问题的ActionBarActivity,尝试替换此代码,

<activity
android:name=".MainActivity"
android:label="@string/app_name" >

in Manifest with,

<activity
android:name=".MainActivity"
android:theme="@style/Theme.AppCompat"
android:label="@string/app_name" >