Android< 5上的应用启动崩溃(可能与firebase相关)

时间:2016-12-03 22:12:51

标签: android firebase

我在Android版本< 5的设备上运行我的应用程序遇到了一些问题(在Lollipop和Marshmellow上运行正常,在Jelly Bean启动时崩溃)。

可以提供帮助的事情:我在我的应用上使用谷歌地图。

这是调试代码:

    I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1302)
I/ActivityThread: Pub com.developer.project.firebaseinitprovider: com.google.firebase.provider.FirebaseInitProvider
I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
W/dalvikvm: VFY: unable to resolve interface method 21082: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
W/dalvikvm: VFY: unable to resolve interface method 21084: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
W/dalvikvm: VFY: unable to resolve interface method 21088: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
W/dalvikvm: VFY: unable to resolve virtual method 683: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
W/dalvikvm: VFY: unable to resolve virtual method 705: Landroid/content/res/TypedArray;.getType (I)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
I/dalvikvm: Could not find method android.support.graphics.drawable.VectorDrawableCompat.getLayoutDirection, referenced from method android.support.graphics.drawable.VectorDrawableCompat.needMirroring
W/dalvikvm: VFY: unable to resolve virtual method 3949: Landroid/support/graphics/drawable/VectorDrawableCompat;.getLayoutDirection ()I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x000f
I/dalvikvm: Could not find method android.widget.FrameLayout.startActionModeForChild, referenced from method android.support.v7.widget.ActionBarContainer.startActionModeForChild
W/dalvikvm: VFY: unable to resolve virtual method 21671: Landroid/widget/FrameLayout;.startActionModeForChild (Landroid/view/View;Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0002
I/dalvikvm: Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
W/dalvikvm: VFY: unable to resolve virtual method 20966: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0007
I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
W/dalvikvm: VFY: unable to resolve virtual method 442: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
W/dalvikvm: VFY: unable to resolve virtual method 646: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
W/dalvikvm: VFY: unable to resolve virtual method 648: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
W/dalvikvm: VFY: unable to resolve instanceof 186 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
D/dalvikvm: GC_CONCURRENT freed 221K, 4% free 8135K/8391K, paused 14ms+1ms, total 24ms
W/ResourceType: Failure getting entry for 0x7f020083 (t=1 e=131) in package 0 (error -75)
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xae6aa228)
E/AndroidRuntime: FATAL EXCEPTION: main
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.developer.project/com.developer.project.MainActivity}: android.view.InflateException: Binary XML file line #30: Error inflating class ImageView
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
                      at android.app.ActivityThread.access$600(ActivityThread.java:130)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
                      at android.os.Handler.dispatchMessage(Handler.java:99)
                      at android.os.Looper.loop(Looper.java:137)
                      at android.app.ActivityThread.main(ActivityThread.java:4745)
                      at java.lang.reflect.Method.invokeNative(Native Method)
                      at java.lang.reflect.Method.invoke(Method.java:511)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                      at dalvik.system.NativeStart.main(Native Method)
                   Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class ImageView
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
                      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
                      at com.developer.project.MainActivity.onCreate(MainActivity.java:38)
                      at android.app.Activity.performCreate(Activity.java:5008)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                      at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                      at android.os.Handler.dispatchMessage(Handler.java:99) 
                      at android.os.Looper.loop(Looper.java:137) 
                      at android.app.ActivityThread.main(ActivityThread.java:4745) 
                      at java.lang.reflect.Method.invokeNative(Native Method) 
                      at java.lang.reflect.Method.invoke(Method.java:511) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                      at dalvik.system.NativeStart.main(Native Method) 
                   Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020083 a=-1 r=0x7f020083}
                      at android.content.res.Resources.loadDrawable(Resources.java:1897)
                      at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
                      at android.widget.ImageView.<init>(ImageView.java:120)
                      at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:60)
                      at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:56)
                      at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                      at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1017)
                      at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1076)
                      at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
                      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143) 
                      at com.developer.project.MainActivity.onCreate(MainActivity.java:38) 
                      at android.app.Activity.performCreate(Activity.java:5008) 
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                      at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                      at android.os.Handler.dispatchMessage(Handler.java:99) 
                      at android.os.Looper.loop(Looper.java:137) 
                      at android.app.ActivityThread.main(ActivityThread.java:4745) 
                      at java.lang.reflect.Method.invokeNative(Native Method) 
                      at java.lang.reflect.Method.invoke(Method.java:511) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                      at dalvik.system.NativeStart.main(Native Method) 

在异常中,您可以看到“错误导致类ImageView”,但是如果我删除了ImageView错误,它就在textvivew中等等......

“MainActivity”中的错误位于“setContentView”

这是mainActivity xml(我觉得没用......):

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <RelativeLayout 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="#F8F8F8">


        <TextView
            android:layout_width="100dp"
            android:layout_height="5dp"
            android:id="@+id/textView72"
            android:textSize="20dp"
            android:gravity="center_vertical"
            android:background="#CCCCCC"
            android:paddingLeft="10dp"
            android:textColor="#FFFFFF"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />

        <ImageView
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:id="@+id/imageViewInfo"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:src="@drawable/info_logo"
            android:layout_marginBottom="5dp"
            android:layout_marginRight="5dp" />

        <GridLayout
            android:layout_width="295dp"
            android:layout_height="175dp"
            android:id="@+id/gridLayoutStart"
            android:background="#FFF9F9"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true">

            <Button
                android:layout_width="285dp"
                android:layout_height="85dp"
                android:text="@string/searchByCity"
                android:id="@+id/btnSearchCity"
                android:layout_row="0"
                android:layout_column="0"
                android:background="@drawable/circlebutton_top"
                android:textColor="#FFFFFF"
                android:textSize="18dp"
                android:typeface="sans"
                android:textAllCaps="false"
                android:drawableLeft="@drawable/search_40"
                android:paddingLeft="10dp"
                android:layout_columnSpan="2"/>

            <Button
                android:layout_width="285dp"
                android:layout_height="85dp"
                android:text="@string/nearMe"
                android:id="@+id/btnNearMe"
                android:layout_row="1"
                android:layout_column="0"
                android:background="@drawable/circlebutton_bottom"
                android:textColor="#FFFFFF"
                android:textSize="18dp"
                android:typeface="sans"
                android:textAllCaps="false"
                android:drawableLeft="@drawable/map_40"
                android:paddingLeft="10dp"
                android:layout_marginTop="5dp"
                android:layout_columnSpan="2" />

        </GridLayout>

    </RelativeLayout>

<ListView
android:id="@+id/navListBench"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:background="#ffeeeeee"/>

</android.support.v4.widget.DrawerLayout>

我确认在使用Android 5和6的设备上,应用程序运行正常...

1 个答案:

答案 0 :(得分:0)

解决。 问题不在于firebase,而在于drawables。

在例外中,正确的观察是“资源不是可绘制的”。 有两个可绘制的文件夹:一个叫做“drawable”,另一个叫“drawable-21”。 我已将所有内容移至主要的drawable文件夹,现在它正在运行。