'Cannot access fragmentclass file for android.support.v4.fragment not found
I am trying to do this in android studio:
Glide.with(getApplicationContext()).load(Uri.parse(url.get((int)(5)))).into(imageview6);
but it shows the following error
error: cannot access Fragment Glide.with(getApplicationContext()).load(Uri.parse(url.get((int)(5)))).into(imageview6);
Cannot access fragmentclass file for android.support.v4.fragment not found
I have tried Migrate to AndroidX but it simply says "no usage found".
Solution 1:[1]
Use getActivity() to get the context in Fragment class.
Use getActivity() instead of getApplicationContext()
Final the code will be
Glide.with(getActivity()).load(Uri.parse(url.get((int)(5)))).into(imageview6);
Hope this will work.
Solution 2:[2]
I used the old glide dependencies that's why I got this error. try to use the newly updated dependency. That works for me!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Faysal Ahmed |
| Solution 2 | Saurav Gawali |
