Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rendering Problems of android.support.design.widget.CoordinatorLayout

i'm facing problem after upgrading the android studio to 2.2.3 problem is using android.support.design.widget.CoordinatorLayout it shows this error

The following classes could not be found: - android.support.design.widget.CoordinatorLayout (Fix Build Path, Edit XML, Create Class) - android.support.design.widget.TextInputLayout (Fix Build Path, Edit XML, Create Class) Tip: Try to build the project. Tip: Try to refresh the layout. \app\src\main\res\layout\activity_main.xml" in attribute "imeActionId" is not a valid integer

i tried to fix build path but didn't work for me. when i build and run it shows

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.CoordinatorLayout" on path: DexPathList[[zip file "/data/app/fitness.aclass.fitness-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.view.LayoutInflater.createView(LayoutInflater.java:571) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) at android.view.LayoutInflater.inflate(LayoutInflater.java:482)  at android.view.LayoutInflater.inflate(LayoutInflater.java:414)  at android.view.LayoutInflater.inflate(LayoutInflater.java:365)  at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  at fitness.aclass.fitness.MainActivity.onCreate(MainActivity.java:11)  at android.app.Activity.performCreate(Activity.java:6092)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)  at android.app.ActivityThread.access$800(ActivityThread.java:178)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)  at android.os.Handler.dispatchMessage(Handler.java:111)  at android.os.Looper.loop(Looper.java:194)  at android.app.ActivityThread.main(ActivityThread.java:5624)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)  Suppressed: java.lang.ClassNotFoundException: android.support.design.widget.CoordinatorLayout at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 22 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

this is my build.gradle (App Module)

   apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        applicationId "fitness.aclass.fitness"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.0'

    testCompile 'junit:junit:4.12'
}

Any solution for this.!

like image 626
Muhammad Saad Bhatti Avatar asked Jan 05 '23 11:01

Muhammad Saad Bhatti


2 Answers

CoordinatorLayout is part of design library. So you should add

implementation' com.android.support:design:28.0.0'

or 24.2.0 version if you need to use outdated version for some reason.

like image 61
Divers Avatar answered Jan 14 '23 06:01

Divers


Try to clean project from Build menu some time due to gradle build caching it happens. and one more thing try to use latest one as they have resolved many issues.

like image 41
Wasim K. Memon Avatar answered Jan 14 '23 06:01

Wasim K. Memon