Issue
Recently I have downloaded a code from GitHub and synced it with my android studio. I have faced lots of errors and issues while doing so and somehow fixed most of them. However, the last issue I'm stuck at right now is that my android studio cannot find the class FloatingActionButton as you can see in this screenshot
It is to be noted that earlier many other classes, including 'AppCompatActivity' could not be resolved. changing the dependencies to following solved the issue
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
But even after changing dependencies, clean building the project, doing 'Invalidate Caches / Restart...', the problem with 'FloatingActionButton' is still there. can anyone please help me with the solution?
You can check the repository here
And this is the java code of the activity where the error is occurring
Update for AndroidX:
The answer of @Sub 6 Resources was perfect before androidX was introduced. Now, it is better to include the following dependency instead of the accepted answer's dependency:
com.google.android.material:material:1.0.0
NOTE: it might not be the latest version by the time you are reading this.
Solution
The FloatingActionButton is in the design library.
Add this line to your dependencies:
implementation 'com.android.support:design:27.1.1'
This post also has more general info about FloatingActionButton
: FloatingActionButton example with Support Library
Answered By - Sub 6 Resources
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.