The Following Classes Could not Be Found Error (latest version) - java

Im getting the error
The following classes could not be found:
- android.support.design.widget.CoordinatorLayout (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)
Tip: Try to build the project.
Heres my module app:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
I've tried to rebuild, clean and change the implementations but nothings seems to work
Does anyone know how I could fix this?? it started when I updated android studio and created a new project.

Your dependency is mixed of support library and AndroidX which is not right. Refactor it to AndroidX using Android Studio.
Refactor > Migrate to AndroidX and press Do Refactor
You have to use
androidx.coordinatorlayout.widget.CoordinatorLayout
com.google.android.material.navigation.NavigationView
androidx.drawerlayout.widget.DrawerLayout
instead of
android.support.design.widget.CoordinatorLayout
android.support.design.widget.NavigationView
android.support.v4.widget.DrawerLayout

Related

Implementation 'com.google.android.gms:play-services-ads:18.1.0'

I want to add ads to my project but when i add the line below, it doesn't work:
implementation 'com.google.android.gms:play-services-ads:18.1.0'
these are the dependencies from the build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.gms:play-services-ads:18.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
It is likely, that you might not have added the Google Services Gradle Plugin to the project, as well as the google-services.json file (which can be downloaded from the Firebase console) - and so your application fails to authenticate.
Adding the com.google.android.gms.ads.APPLICATION_ID into the AndroidManifest.xml has the same effect, because the Play Services plugin adds the values from google-services.json at build-time.
... when only using AdMob, the second option should be preferred.
Do you have inside top-level build.gradle file reference to the google() repo or to maven { url "https://maven.google.com" }? Do you have some specific error inside log?
Try to create a new project and copy old project files and paste in a new one. If it should help!

Can't implement the librabry 'me.zhanghai.android.materialprogressbar:library:1.6.1' in Android Studio 3.4.1

I'm following the tutorial https://www.youtube.com/watch?v=X5AOrAhyrkg&list=PLRRNzqzbPLd8Qldg1J3LFesfXW9hWM_t4&index=3&t=0s
But when I implement the library 'me.zhanghai.android.materialprogressbar:library:1.6.1' it causes some error.
I did take a look at Android Material and appcompat Manifest merger failed but when I try that solution on It doesn't work for me. I know that I'm using the latest version of AndroidX which is the problem. But I haven't figured it out yet.
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 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'
implementation 'com.android.support.constraint:constraint-layout: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'
}
So I hope to find a solution
This is what I encountered previously with third party libraries. This issue occurs when you are currently migrated to Androidx and the third party lib (in your case, 'me.zhanghai.android.materialprogressbar:library:1.6.1') is still using android support and it will clash causing the merge dex error.
I don't think if this will help, but do try adding this.
('me.zhanghai.android.materialprogressbar:library:1.6.1'){
exclude group: "com.android.support"
}
If it doesn't, you might have to post your issue on their github page and see if they can promise u an answer.

How to install lettuce library on Android Studio?

How to install lettuce library on Android studio in Gradle files ?
https://lettuce.io
is there any solution to compile the library ?
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0’
}
In the lettuce's getting started section there is a section called For Gradle Users on how to add the library from gradle. I think just adding:
implementation 'io.lettuce:lettuce-core:5.1.3.RELEASE'
would work. You must check if you must adjust your current dependencies and/or modify your proguard rules.
Hope I helped.

New material dependencies not working on CoordinatorLayout preview

So, i have added all the android new material depency in order to work with BottomAppBar , but after I imported all and changed what the documentation suggest I cant even see the preview and when I compile I get the error that test.runner does not exists, and thats is maybe I removed the support.test.runner because it says that we don't need to mix support with material.
This is what I have done
My dependencies
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
testImplementation 'junit:junit:4.12'
implementation "androidx.room:room-runtime:2.1.0-alpha01"
annotationProcessor "androidx.room:room-compiler:2.1.0-alpha01"
}
Styles
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
I added to my AndroidManifest application tag this two suggeste lines by the compiler
tools:replace="android:appComponentFactory"
android:appComponentFactory="settings"
I changed all the AppCompat from all my classes and replace them with the new AndroidX AppCompat
Errors
error: package android.support.test does not exist
this might be caused because I deleted support.test from my gradle since in the doc says we dont need to mix support with material.
And this error trying to preview coordinatorLayout
Any clue what it could be and how to solve all of this since I need to work with this material design as soon as posible.
Another thing, since it has AppCompat, I can run and see this design on my android 7 ?
thanks
What version of Android studio you have?
According here: https://developer.android.com/jetpack/androidx/migrate
Android studio must be 3.2 or higher.
If your android studio is now 3.2 or higher there is an option under Refactor tab- "Migrate to AndroidX" wait it to compile everything and AS will migrate your existing project to androidX which is the Material you are looking for.
If you may ask, here is my dependency for androidx:
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
Solved my problem just importing all material dependencies and not using any support ones

Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.google.android.things:androidthings:1.0 error while gradle sync

I make new android things app with api level 24.
I got error msg during gradle build:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.google.android.things:androidthings:1.0.
My app build.gradle looks like this:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
compileOnly 'com.google.android.things:androidthings:1.0'
}
Thank you in any help.
Problem was caused by corporate proxy. Although i have setup proxy in android studio. It looks like gradle was not affected by it.
I just switched to android hotspot before start of gradle build and everything worked fine.

Categories

Resources