1

I'm having trouble with missing classes. "The following classes could not be found:" messages making me sick.

I've tried most of answers in stackoverflow answers and it didn't helped at all. I create the file with navigation bar project then applied my files in to Firebase.

I tried to Change the dependencies and Style files. here is my Dependency :

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
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.google.firebase:firebase-analytics:17.2.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
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.google.firebase:firebase-analytics:17.2.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'

and here is my style code

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay"     
parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

I've already changed Apptheme part Theme.App to Base.Theme.App

And also tried files to invalid caches/restart method.

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
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.google.firebase:firebase-analytics:17.2.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'

This is xml file

<?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_main"
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" />

</android.support.v4.widget.DrawerLayout>

These are my error messages. It is given in preview error.

The following classes could not be found: - android.support.constraint.ConstraintLayout (    Add constraint-layout library dependency to the project, Fix Build Path, Edit XML, Create Class) - android.support.design.widget.AppBarLayout (Fix Build Path, Edit XML, Create Class) - android.support.design.widget.CoordinatorLayout (Fix Build Path, Edit XML, Create Class) - android.support.design.widget.FloatingActionButton (Fix Build Path, Edit XML, Create Class) - android.support.design.widget.NavigationView (Fix Build Path, Edit XML, Create Class) - android.support.v4.widget.DrawerLayout (Fix Build Path, Edit XML, Create Class) - android.support.v7.widget.Toolbar (Fix Build Path, Edit XML, Create Class)

Is there anything I could try to fix this? Or do I have to reset everything?

1 Answers1

2
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Then Read AndroidX .

Your XML will -->

 <androidx.constraintlayout.widget.ConstraintLayout
 <com.google.android.material.navigation.NavigationView
 <androidx.cardview.widget.CardView
 <androidx.appcompat.widget.Toolbar
 <com.google.android.material.appbar.AppBarLayout
 <androidx.coordinatorlayout.widget.CoordinatorLayout

The following classes could not be found: - android.support.constraint.ConstraintLayout

Then use

 implementation 'com.android.support.constraint:constraint-layout:1.1.2'
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198