应用程序不断崩溃。有什么想法吗?

时间:2017-02-23 14:18:54

标签: android

任何时候我尝试使用我的nexus作为测试设备,应用程序崩溃,我看到这个错误。我不确定问题出在哪里。  E / AndroidRuntime:致命异常:主要                   过程:com.delta.bartalk,PID:13668                   java.lang.RuntimeException:无法启动活动ComponentInfo {com.delta.bartalk / com.delta.bartalk.BartalkActivity}:android.content.res.Resources $ NotFoundException:Resource ID#0x7f020000                       在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)                       在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)                       在android.app.ActivityThread.access $ 800(ActivityThread.java:151)                       在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1303)                       在android.os.Handler.dispatchMessage(Handler.java:102)                       在android.os.Looper.loop(Looper.java:135)                       在android.app.ActivityThread.main(ActivityThread.java:5254)                       at java.lang.reflect.Method.invoke(Native Method)                       在java.lang.reflect.Method.invoke(Method.java:372)                       在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:903)                       在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)                    引起:android.content.res.Resources $ NotFoundException:资源ID#0x7f020000                       在android.content.res.Resources.getValue(Resources.java:1266)                       在android.content.res.Resources.getDrawable(Resources.java:785)                       在android.content.Context.getDrawable(Context.java:403)                       在com.android.internal.widget.ActionBarView.setIcon(ActionBarView.java:684)                       在com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:738)                       在com.android.internal.policy.impl.PhoneWindow.setDefaultIcon(PhoneWindow.java:1646)                       在android.app.Activity.initWindowDecorActionBar(Activity.java:2131)                       在android.app.Activity.setContentView(Activity.java:2146)                       at com.delta.bartalk.BartalkActivity.onCreate(BartalkActivity.java:64)                       在android.app.Activity.performCreate(Activity.java:5990)                       在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)                       在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)                       在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)                       在android.app.ActivityThread.access $ 800(ActivityThread.java:151)                       在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1303)                       在android.os.Handler.dispatchMessage(Handler.java:102)                       在android.os.Looper.loop(Looper.java:135)                       在android.app.ActivityThread.main(ActivityThread.java:5254)                       at java.lang.reflect.Method.invoke(Native Method)                       在java.lang.reflect.Method.invoke(Method.java:372)                       在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:903)                       在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

/ *这是activity_bartalk.xml的开头我不太确定这是错误可能在哪里* /

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    tools:context=".BartalkActivity">

    <!-- The primary full-screen view. This can be replaced with whatever view
         is needed to present your content, e.g. VideoView, SurfaceView,
         TextureView, etc. -->
    <com.delta.bartalk.AutoResizeTextView
        android:id="@+id/fullscreen_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:keepScreenOn="true"
        android:textColor="#bc7ff6"
        android:textStyle="bold"
        android:maxLines="2"
        android:textSize="600sp"
        android:gravity="center"
        android:text="@string/bartalk" />

    <!-- This FrameLayout insets its children based on system windows using
         android:fitsSystemWindows. -->
    <FrameLayout android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <LinearLayout android:id="@+id/fullscreen_content_controls"
            style="?metaButtonBarStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"
            android:background="@color/black_overlay"
            android:orientation="horizontal"
            tools:ignore="UselessParent">

            <EditText android:id="@+id/input_text"
                style="?metaButtonBarButtonStyle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"``
                android:hint="@string/what_do_you_want_to_say" />

        </LinearLayout>
    </FrameLayout>

</FrameLayout>

1 个答案:

答案 0 :(得分:2)

我认为其中一个资源ID实际上是丢失的,这可能是strings.xml文件中的字符串,dimen.xml文件,drawable,image。

从查看堆栈跟踪的第四行看起来是这样的:

 android.content.res.Resources$NotFoundException: Resource ID #0x7f020000 at 

请检查是否所有内容都专门用于该特定活动的XML文件。

很抱歉,但是在编辑后现在从堆栈跟踪中查看我实际上可以看到它因为缺少Drawable而崩溃。请检查ActionBar的drawable。