1
votes

I have updated compile sdk version to 23 ,which brings me to list of error related to floating action button. couldnt able to fix it , any help highyl appreciated.

2019-11-06 15:11:26.767 2777-2777/? E/AndroidRuntime: FATAL EXCEPTION: main Process: xyz, PID: 2777 java.lang.RuntimeException: Unable to start activity ComponentInfo{xz.MediaPresentationActivity}: android.view.InflateException: Binary XML file line #86: Binary XML file line #86: Error inflating class android.support.design.widget.FloatingActionButton at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3125) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3268) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1959) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7100) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) Caused by: android.view.InflateException: Binary XML file line #86: Binary XML file line #86: Error inflating class android.support.design.widget.FloatingActionButton Caused by: android.view.InflateException: Binary XML file line #86: Error inflating class android.support.design.widget.FloatingActionButton Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:686) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:829) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769) at android.view.LayoutInflater.rInflate(LayoutInflater.java:902) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:863) at android.view.LayoutInflater.inflate(LayoutInflater.java:554) at android.view.LayoutInflater.inflate(LayoutInflater.java:461) at android.view.LayoutInflater.inflate(LayoutInflater.java:383) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:469) at android.app.Activity.setContentView(Activity.java:2858) at com.syz.MediaPresentationActivity.onCreate(MediaPresentationActivity.java:1089) at android.app.Activity.performCreate(Activity.java:7327) at android.app.Activity.performCreate(Activity.java:7318) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1275) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3105) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3268) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1959) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7100) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.


build.gradle

apply plugin: 'com.android.application'

android {

   compileSdkVersion 23
    defaultConfig {
        applicationId "com.xyz"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode timeCounter
        versionName "${version}"
    }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.google.android.gms:play-services-appindexing:8.1.0'
    implementation 'com.android.support:design:23.2.1'
    implementation 'com.android.support:appcompat-v7:23.1.1'

}

-manifest..

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xyz.e">
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CONFIGURE_SIP" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>

<!-- Declares necessary features for the app to work -->


    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">

        <activity
            android:name=".FullscreenActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/app_name"
            android:launchMode="singleInstance"
            android:theme="@style/FullscreenTheme">
            <!--
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.HOME" />
               <category android:name="android.intent.category.DEFAULT" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
           -->
        </activity>

        <activity
            android:name=".MediaPresentationActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="eFrame"
            android:launchMode="singleInstance"
            android:screenOrientation="landscape"
            >

        </activity>

       <activity
            android:name=".SettingsActivity"
            android:label="@string/title_activity_settings"
            android:parentActivityName=".SettingsActivity"
            android:theme="@android:style/Theme.DeviceDefault">
            <meta-data android:name="android.support.PARENT_ACTIVITY android:value="com.serv24.eframe.SettingsActivity" />
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <receiver android:name=".IncomingReceiver" android:label="Call Receiver"/>

</application>

</manifest>
1
Does the shadow_mid_color color exist in your project?Gabriele Mariotti
sorry i have updated my question , shadow was not an issue , but my app crashes with above error on updaing to version 23 ,Tim
You need to use a Theme.AppCompat theme. Which app theme are you using?Gabriele Mariotti
can you please look at my manifest , i have used DeviceDefault themeTim
In your MediaPresentationActivity you are using @style/AppThemeGabriele Mariotti

1 Answers

-1
votes

I suggest using AndroidX instead of the old support library since it ensures better compatibility throughout libraries and api levels.

To start with that, add the following to your build.gradle

 implementation 'androidx.legacy:legacy-support-v4:1.0.0'

Also use the assistant: Refactor > Migrate to AndroidX

There might come up some errors at first but they should be fixed by replacing com.android etc with androidx instead and here are many posts to that topic.

Also you could try to directly address the Button using this inside the xml:

android.support.design.widget.FloatingActionButton

Hope this helps :) Good luck!