首页 文章

应用程序不断崩溃 . 有任何想法吗?

提问于
浏览
-5

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

/ 这是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 回答

  • 2

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

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

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

    请检查是否所有内容都专门针对该特定活动的XML文件进行了说明 .

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

相关问题