Error inflating class android.support.design.widget.CoordinatorLayout and ClassNotFoundException: android.support.design.R$styleable

后端 未结 5 460
时光取名叫无心
时光取名叫无心 2020-11-30 13:21

I am developing an app which have Tab with swipe functionality. I am using Eclipse to develop. I have imported the support design library as Library through Pro

相关标签:
5条回答
  • 2020-11-30 14:02

    I got this error while Migrating to AndroidX

    To resolve I did:

    1. as suggested by @Mikeumus - and added this to the module's build.gradle dependencies:

      implementation 'androidx.coordinatorlayout:coordinatorlayout:latest.version.here'

    2. check in the Layout XML file (the layout that you're trying to launch with setContentView

    if the Layout contains: <android.support.design.widget.CoordinatorLayout ...

    replace that with : <androidx.coordinatorlayout.widget.CoordinatorLayout

    1. in the same layout file - replace the closing tag

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

    with

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    0 讨论(0)
  • 2020-11-30 14:08

    For me, this error was resulting from using some androidx libraries but then still having the old coordinate layout in some layout.xml files.

    build.gradle:

    com.android.support:coordinatorlayout -> androidx.coordinatorlayout:coordinatorlayout:1.0.0-alpha1

    If you're using androidx then maybe this is your problem too. I had to update the other v7 libraries like Toolbar as well.

    See the androidx migration guide here: https://developer.android.com/topic/libraries/support-library/refactor

    0 讨论(0)
  • 2020-11-30 14:15

    For android studio try to add these dependencies

    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    
    0 讨论(0)
  • 2020-11-30 14:18

    I found the solution for eclipse

    Problem what i faced is R.Java file is not generated under support.design in gen/ folder.

    After doing the below steps R.Java file is generated. Main issue is design library is target to 22. Changing to 23 worked.

    1. Import support design library from \sdk\extras\android\support\design to eclipse workspace.

    2. Open project.properties of AppCompat and design Library and target it to 23

    3. Clean Appcompat, design and YourProject.

    4. Run the app

    0 讨论(0)
  • 2020-11-30 14:20

    Make sure that in your activity set theme AppCompat

    <activity
                android:name=".newApp.screens.main.MainActivity"
                android:label="@string/title_activity_main_launch"
                android:theme="@style/AppThemes"></activity>
    
      <!-- Base application theme. -->
    <style name="AppThemes" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#673AB7</item>
        <item name="colorPrimaryDark">#512DA8</item>
        <item name="colorAccent">#00BCD4</item>
    </style>
    
    0 讨论(0)
提交回复
热议问题