Android应用程序在平板电脑模拟器上崩溃,但没有电话

时间:2017-11-18 14:49:24

标签: android

我在平板电脑模拟器上测试时,我的应用程序崩溃了。它不会在手机模拟器上崩溃。以下是logcat的错误,如果您需要更多信息,请告诉我。

11-18 08:34:14.654 4233-4233/io.myapp.app E/AndroidRuntime: FATAL EXCEPTION: main
                                                                  Process: io.myapp.app, PID: 4233
                                                                  java.lang.RuntimeException: Unable to start activity ComponentInfo{io.myapp.app/io.myapp.app.NoteTrainerActivity}: android.view.InflateException: Binary XML file line #0: Error inflating class ImageView
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
                                                                      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:5254)
                                                                      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: android.view.InflateException: Binary XML file line #0: Error inflating class ImageView
                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                                                                      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                                                                      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                                                                      at io.myapp.app.NoteTrainerActivity.onCreate(NoteTrainerActivity.kt:51)
                                                                      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:2387) 
                                                                      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:5254) 
                                                                      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: android.content.res.Resources$NotFoundException: Resource ID #0x7f060480
                                                                      at android.content.res.Resources.getValue(Resources.java:1266)
                                                                      at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:330)
                                                                      at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
                                                                      at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
                                                                      at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
                                                                      at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:58)
                                                                      at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:78)
                                                                      at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
                                                                      at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                                                                      at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
                                                                      at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                                                      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
                                                                      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
                                                                      at io.myapp.app.NoteTrainerActivity.onCreate(NoteTrainerActivity.kt:51) 
                                                                      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:2387) 
                                                                      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:5254) 
                                                                      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) 

编辑: 我已经跟踪了这部分logcat资源$ NotFoundException:资源ID#0x7f060480

它是一个名为“c4”的图像,但它旁边有一个(v24),而我的大多数其他图像都没有。这可能与它有关吗?

根据请求,这里是xml文件:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="io.myapp.app.NoteTrainerActivity">

    <ImageView
        android:id="@+id/noteImage"
        android:layout_width="0dp"
        android:layout_height="200dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/c4" />

    <GridLayout
        android:layout_width="368dp"
        android:layout_height="287dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/noteImage">

        <Button
            android:id="@+id/c_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="C" />

        <Button
            android:id="@+id/csharp_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:layout_row="0"
            android:text="C#" />

        <Button
            android:id="@+id/dflat_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="2"
            android:layout_row="0"
            android:text="Db"
            android:textAllCaps="false" />

        <Button
            android:id="@+id/d_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="3"
            android:layout_row="0"
            android:text="D" />

        <Button
            android:id="@+id/dsharp_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_row="1"
            android:text="D#" />

        <Button
            android:id="@+id/eflat_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:layout_row="1"
            android:text="Eb"
            android:textAllCaps="false" />

        <Button
            android:id="@+id/e_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="2"
            android:layout_row="1"
            android:text="E" />

        <Button
            android:id="@+id/f_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="3"
            android:layout_row="1"
            android:text="F" />

        <Button
            android:id="@+id/fsharp_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_row="2"
            android:text="F#" />

        <Button
            android:id="@+id/gflat_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:layout_row="2"
            android:text="Gb"
            android:textAllCaps="false" />

        <Button
            android:id="@+id/g_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="2"
            android:layout_row="2"
            android:text="G" />

        <Button
            android:id="@+id/gsharp_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="3"
            android:layout_row="2"
            android:text="G#" />

        <Button
            android:id="@+id/aflat_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_row="3"
            android:text="Ab"
            android:textAllCaps="false" />

        <Button
            android:id="@+id/a_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:layout_row="3"
            android:text="A" />

        <Button
            android:id="@+id/asharp_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="2"
            android:layout_row="3"
            android:text="A#" />

        <Button
            android:id="@+id/bflat_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="3"
            android:layout_row="3"
            android:text="Bb"
            android:textAllCaps="false" />

        <Button
            android:id="@+id/b_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_row="4"
            android:text="B" />
    </GridLayout>
</android.support.constraint.ConstraintLayout>

0 个答案:

没有答案