'how to fix setOpenableLayout in layout Navigation Drawer Activity

i have a problem why is setOpenableLayout not working?

mAppBarConfiguration = new AppBarConfiguration.Builder(
                R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow)
                .setOpenableLayout(drawer)
                .build();

show error :

error: cannot find symbol .setOpenableLayout(drawer) ^ symbol: method setOpenableLayout(DrawerLayout) location: class Builder

maybe someone here can help me



Solution 1:[1]

What is your gradle config.

Look a problem of sdk versions. Try changing ".setOpenableLayout(drawer)" for ".setDrawerLayout(drawer)".

Anyway, it's possible for your minSdk method setOpenableLayout does not exist yet.

Solution 2:[2]

I'd advise to set higher version of androidx.navigation:navigation-ui (say 2.4.1).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Genaut
Solution 2 Tropic