Search code examples
androidgradledrawerlayout

Class 'android.support.v4.widget.DrawerLayout' not found (SDK Level 25+)


In my Android application I'm using Activities that are derived from AppCompatActivity. This requires at some point the DrawerLayout. Therefore I have added

 compile 'com.android.support:support-v4:25.1.0@aar'

to my build.gradle. This worked fine, till I switched to SDK Level 25 - now the build fails with

class file for android.support.v4.widget.DrawerLayout not found
:app:compileDebugJavaWithJavac FAILED.

I check the support repo of the SDK on my disk and support-v4-25.1.0.aar doesn't contain the DrawerLayout.class any more. (It has only 2 kb and doesn't contain any classes which were in v4-24+).

I already reinstalled the support repo with the SDK Manager, but I was unable to make this work.

Which library to I have to add to my gradle file in order to make my build work? (compileSdkVersion 25, buildToolsVersion "25.0.2")


Solution

  • Google better modularized popular components from the support-v4/appcompat-v7 libraries into their own libraries with release from 24.1.1 to 24.2.0. So the v4 is empty and you have to integrate the component libraries such as 'support-core-ui'. (https://www.reddit.com/r/androiddev/comments/4y70e7/android_support_library_v242_released/)