0

So I'm new to android studio and using the latest version (3.1.4) in Kali Linux. I have an issue with the NavigationView activity. Whenever I try to create one, the drawer itself doesn't show and instead I get the "Waiting for build to finish" message even though the gradle build has already finished. I tried the solution where you cut the tools:showIn="navigation_view" in activity_main_drawer, rebuild the project and paste back the line but still doesn't work. My gradle.build dependencies are well set up too. What would be the issue? Also at time when I create the same activity at time I get an "IDE Error occured" message but all the other activities work just fine.

My code for activity_main_drawer.xml is as follows.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:showIn="navigation_view">

<group android:checkableBehavior="single">
    <item
        android:id="@+id/nav_camera"
        android:icon="@drawable/ic_menu_camera"
        android:title="Import" />
    <item
        android:id="@+id/nav_gallery"
        android:icon="@drawable/ic_menu_gallery"
        android:title="Gallery" />
    <item
        android:id="@+id/nav_slideshow"
        android:icon="@drawable/ic_menu_slideshow"
        android:title="Slideshow" />
    <item
        android:id="@+id/nav_manage"
        android:icon="@drawable/ic_menu_manage"
        android:title="Tools" />
</group>

<item android:title="Communicate">
    <menu>
        <item
            android:id="@+id/nav_share"
            android:icon="@drawable/ic_menu_share"
            android:title="Share" />
        <item
            android:id="@+id/nav_send"
            android:icon="@drawable/ic_menu_send"
            android:title="Send" />
    </menu>
</item>

</menu>

That for activity_main.xml is as follows

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">

<include
    layout="@layout/app_bar_main2"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    app:menu="@menu/activity_main_drawer" />

and my build.grable dependecies

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support:design:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:support-v4:28.0.0-rc01'
    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'
}

This is what I get on the drawer activity

This is what I get on the drawer activity

Quick learner
  • 10,632
  • 4
  • 45
  • 55
Abedy
  • 361
  • 5
  • 17
  • 1
    In order to help you better, you need to provide a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). Please read this article, and provide this example. – Marc Estrada Aug 24 '18 at 08:14
  • Please share your code for Navigation Drawer Activity. – Reaz Murshed Aug 24 '18 at 08:17
  • Related **[navigation drawer issue (not showing layout preview)](https://stackoverflow.com/questions/50201356/navigation-drawer-issue-not-showing-layout-preview/50221647#50221647)** – AskNilesh Aug 24 '18 at 08:19
  • Probably a support (and other android libraries) library should be "28.0.0-alpha1" version. – CoolMind Aug 24 '18 at 08:21
  • @NileshRathod I tried that but doesn't work for me. The issue still persists – Abedy Aug 24 '18 at 08:21
  • 1
    @CoolMind you were right. – Abedy Aug 24 '18 at 10:01
  • @Abedy, I was advised this solution here: https://stackoverflow.com/questions/51441114/coordinatorlayout-is-not-visible-in-design-view. – CoolMind Aug 24 '18 at 12:34

1 Answers1

0

Finally found a solution thanks to this guy on youtube

How to Solve Android Studio 3.1.3 Render Problem

changed the lines:

implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support:design:28.0.0-rc01'

to:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'

in build.gradle Module:app file.

Seems the issue is on the latest version release of the gradle. Thanks for the comments though.

Abedy
  • 361
  • 5
  • 17