0

Tried Many Solution But No Helped

Ref : Failed to find style 'coordinatorLayoutStyle' in current theme

But not Helped

Render Problem:

Failed to find style 'coordinatorLayoutStyle' in current theme

Tip: Try to refresh the layout.

build.gradle file of my project is :

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

module:app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "*****"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:28.0.0-alpha1'
}

main Activity XML code

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    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=".MainActivity">

    <android.support.design.bottomappbar.BottomAppBar
        android:id="@+id/bar"
        style="@style/Widget.MaterialComponents.BottomAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:navigationIcon="@drawable/ic_menu"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:fabAttached="true"
        app:backgroundTint="@color/colorPrimary"
        app:fabCradleVerticalOffset="12dp"/>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_anchor="@id/bar"/>

</android.support.design.widget.CoordinatorLayout>

Why I am Not changing compiled SDK version 28 to 27 bcz I want to use Bottom app bar

Bottom App Bar Material Design

App Bars:Bottom- Material Design

Main Activity Xml

Ashvin solanki
  • 4,802
  • 3
  • 25
  • 65
  • Add this library `implementation 'com.android.support:design:27.1.1'` as well to your module:app, respectively the one corresponding to your sdk – jle Aug 25 '18 at 12:49
  • Maybe this has something to do with the latest support library version although i am not really sure.. So try replacing your current version to 27.1.1 and see if it works. compileSdkVersion 27 targetSdkVersion 27 and implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' – Shivam Pokhriyal Aug 25 '18 at 12:51
  • when changed design and apcompat virsion i got – Ashvin solanki Aug 25 '18 at 12:57
  • error: resource style/Widget.MaterialComponents.BottomAppBar (aka *.appbar:style/Widget.MaterialComponents.BottomAppBar) not found. Message{kind=ERROR, text=error: resource style/Widget.MaterialComponents.BottomAppBar (aka **.appbar:style/Widget.MaterialComponents.BottomAppBar) not found., sources=[/home/android/Desktop/Android Studio Projects/Appbar/app/src/main/res/layout/activity_main.xml:10], original message=, tool name=Optional.of(AAPT)} – Ashvin solanki Aug 25 '18 at 12:57
  • This is happening because Material Components have not yet shipped new releases under the dependency version 27 as of yet. So You'll have to copy the portions of the Material Components library you want directly into your project if you want access to the latest changes. – Shivam Pokhriyal Aug 25 '18 at 13:03
  • see this https://stackoverflow.com/a/52015248/4824088 will help you..! – Mohamed Mohaideen AH Aug 25 '18 at 13:41
  • Possible duplicate of [Failed to find style 'coordinatorLayoutStyle' in current theme In Android Studio 3.1](https://stackoverflow.com/questions/50856622/failed-to-find-style-coordinatorlayoutstyle-in-current-theme-in-android-studio) – ʍѳђઽ૯ท Aug 25 '18 at 18:47
  • I already search about this question – Ashvin solanki Aug 26 '18 at 08:00
  • but I want to use bottom app bar so – Ashvin solanki Aug 26 '18 at 08:01
  • it necessary to use compiled sdk v. 28 or android-P – Ashvin solanki Aug 26 '18 at 08:02
  • Just use the canary version of android studio Here is the link https://developer.android.com/studio/preview/ – GJJ2019 Aug 26 '18 at 05:31

2 Answers2

3

This is a bug in 28.0.0 and the only fix(workaround) is adding this to your Build.gradle:

configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == "com.android.support") {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion "27.1.1"
                }
            }
        }
    }

Which somehow, this bypasses the issue and uses 27 support library for that. Otherwise, you may wanna update your Android Studio to canary channel version or using backward support library like 27.1.1 or etc.

ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
0

This error was occurred in your Rendering Layout which is a part of Studio Not in any files or Library

  1. Try adding "Base" before Theme in styles.xml as show : - "Base.Theme.AppCompat.Light.DarkActionBar"

  2. Please restart Android Studio by selecting the menu option "File" → "Invalidate Caches / Restart"

  3. Workarounds: Try rendering with M preview using AS v1.3 preview OR use FrameLayout for designing and change to android.support.design.widget.CoordinatorLayout while debugging.
Xay
  • 248
  • 3
  • 10