从25更新到支持27和SDK 27,现在在Android 4.4上崩溃

时间:2017-10-28 12:58:01

标签: android kotlin android-support-library

我正在将我的应用更新到Android SDK 27,它现在​​在Android 4.4上崩溃了:

10-28 13:03:16.159 2525-2525/? I/dalvikvm: Could not find method android.content.ContentProviderClient.close, referenced from method fr.geobert.efficio.MainActivity.cleanDatabaseIfTestingMode
10-28 13:03:16.169 2525-2525/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: fr.geobert.efficio, PID: 2525
                                                 java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.geobert.efficio/fr.geobert.efficio.MainActivity}: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.v7.widget.Toolbar
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:136)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5017)
                                                     at java.lang.reflect.Method.invokeNative(Native Method)
                                                     at java.lang.reflect.Method.invoke(Method.java:515)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                     at dalvik.system.NativeStart.main(Native Method)
                                                  Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.v7.widget.Toolbar
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:621)
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
                                                     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:817)
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:759)
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
                                                     at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                                                     at fr.geobert.efficio.MainActivity.onCreate(MainActivity.kt:80)
                                                     at android.app.Activity.performCreate(Activity.java:5231)
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                     at dalvik.system.NativeStart.main(Native Method) 
                                                  Caused by: java.lang.reflect.InvocationTargetException
                                                     at java.lang.reflect.Constructor.constructNative(Native Method)
                                                     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:595)
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 
                                                     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:817) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:759) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                                                     at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
                                                     at fr.geobert.efficio.MainActivity.onCreate(MainActivity.kt:80) 
                                                     at android.app.Activity.performCreate(Activity.java:5231) 
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                     at dalvik.system.NativeStart.main(Native Method) 
                                                  Caused by: android.content.res.Resources$NotFoundException: File res/drawable/titlebar.xml from drawable resource ID #0x7f080081
                                                     at android.content.res.Resources.loadDrawable(Resources.java:2101)
                                                     at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                                                     at android.view.View.<init>(View.java:3554)
                                                     at android.view.ViewGroup.<init>(ViewGroup.java:470)
                                                     at android.support.v7.widget.Toolbar.<init>(Toolbar.java:231)
                                                     at android.support.v7.widget.Toolbar.<init>(Toolbar.java:227)
                                                     at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                     at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:595) 
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 
                                                     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:817) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:759) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                                                     at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
                                                     at fr.geobert.efficio.MainActivity.onCreate(MainActivity.kt:80) 
                                                     at android.app.Activity.performCreate(Activity.java:5231) 
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                     at dalvik.system.NativeStart.main(Native Method) 
                                                  Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_efficio_title_deco_right.xml from drawable resource ID #0x7f08006b
                                                     at android.content.res.Resources.loadDrawable(Resources.java:2101)
                                                     at android.content.res.Resources.getDrawable(Resources.java:700)
                                                     at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:159)
                                                     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
                                                     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
                                                     at android.content.res.Resources.loadDrawable(Resources.java:2097)
                                                     at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 
                                                     at android.view.View.<init>(View.java:3554) 
                                                     at android.view.ViewGroup.<init>(ViewGroup.java:470) 
                                                     at android.support.v7.widget.Toolbar.<init>(Toolbar.java:231) 
                                                     at android.support.v7.widget.Toolbar.<init>(Toolbar.java:227) 
                                                     at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                     at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:595) 
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 
                                                     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:817) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:759) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                                                     at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
                                                     at fr.geobert.efficio.MainActivity.onCreate(MainActivity.kt:80) 
                                                     at android.app.Activity.performCreate(Activity.java:5231) 
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                     at dalvik.system.NativeStart.main(Native Method) 
                                                  Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #0: invalid drawable tag vector
                                                     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
                                                     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
                                                     at android.content.res.Resources.loadDrawable(Resources.java:2097)
                                                     at android.content.res.Resources.getDrawable(Resources.java:700) 
                                                     at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:159) 
                                                     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937) 
                                                     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877) 
                                                     at android.content.res.Resources.loadDrawable(Resources.java:2097) 
                                                     at android.content.res.TypedArray.getDrawable(TypedArray.java:602) 
                                                     at android.view.View.<init>(View.java:3554) 
                                                     at android.view.ViewGroup.<init>(ViewGroup.java:470) 
                                                     at android.support.v7.widget.Toolbar.<init>(Toolbar.java:231) 
                                                     at android.support.v7.widget.Toolbar.<init>(Toolbar.java:227) 
                                                     at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                     at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:595) 
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 
                                                     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:817) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:759) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                                                     at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
                                                     at fr.geobert.efficio.MainActivity.onCreate(MainActivity.kt:80) 
                                                     at android.app.Activity.performCreate(Activity.java:5231) 
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                     at dalvik.system.NativeStart.main(Native Method) 

main_activity.xml:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                        xmlns:app="http://schemas.android.com/apk/res-auto"
                                        android:id="@+id/drawer_layout"
                                        android:layout_width="match_parent"
                                        android:layout_height="match_parent">

    <!-- This LinearLayout represents the contents of the screen  -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <!-- The ActionBar displayed at the top -->
        <include
            layout="@layout/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <!-- The main content view where fragments are loaded -->
        <FrameLayout
            android:id="@+id/flContent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </LinearLayout>

    <!-- The navigation drawer that comes from the left -->
    <!-- Note that `android:layout_gravity` needs to be set to 'start' -->
    <android.support.design.widget.NavigationView
        android:id="@+id/nvView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@android:color/white"
        app:headerLayout="@layout/drawer_header"
        app:menu="@menu/drawer_view"/>
</android.support.v4.widget.DrawerLayout>

toolbar.xml:

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/my_toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/titlebar"
    android:fitsSystemWindows="true"
    android:minHeight="?attr/actionBarSize"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:titleTextColor="@color/colorPrimaryDark">

    <Spinner
        android:id="@+id/store_spinner"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="2dp"
        android:minWidth="150dp"
        app:popupTheme="@style/ToolbarSpinner"/>


</android.support.v7.widget.Toolbar>

styles.xml:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    </style>

    <style name="ToolbarSpinner" parent="ThemeOverlay.AppCompat.Dark">
        <item name="android:background">@color/colorPrimary</item>
    </style>

    <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="color">@color/colorPrimaryDark</item>
    </style>
</resources>

Manifest:

<application
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/efficio_launcher"
        android:label="@string/app_name"
        android:supportsRtl="false"
        android:theme="@style/AppTheme">

build.gradle的一部分:

android {
    compileSdkVersion 27
    buildToolsVersion '26.0.2'

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0RC3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
}

ext.android_support = '27.0.0'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile "com.android.support:support-v4:$android_support"
    compile "com.android.support:design:$android_support"
    compile "com.android.support:cardview-v7:$android_support"
    compile "com.android.support:support-vector-drawable:$android_support"
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

我尝试删除?attr/actionBarSize并将其替换为50dp,但没有运气。我已经检查过我到处都在使用AppCompat主题。我现在不在想: - /

0 个答案:

没有答案