Android Studio and android.support.v4.app.Fragment: cannot resolve symbol
The symptom of this problem is usually that the build works fine from the command line (which means your build.gradle
file is set up right) but you get syntax highlighting errors in the IDE. Follow This Steps To Solve The Problem: Click on Tools from the toolbar usually at the top part of your IDE, and then navigate to Android then navigate to Sync Project with Gradle Files button. We realize it's less than ideal that the IDE can't just take care of itself instead of forcing you to manually sync at the right time; we're tracking progress on this in https://code.google.com/p/android/issues/detail?id=63151
Cannot find symbol error in android studio
You are importing Fragment
from the old Android Support library (android.support.v<x>
) while you’ve configured your project to use AndroidX, so make sure you are importing and using the correct library.
Please visit this link to find the correct import for Fragment
.
Replace
android.support.v4.app.Fragment
withandroidx.fragment.app.Fragment
.
Cannot resolve symbol FragmentActivity
Try removing this section from Basegameutile gradle
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
It prevents the inclusion of the support library.
This section is used when there is a dependency conflict between 2 or more modules because both of them include the support library .
To prevent one of them from including the same dependency use this section.
Android Support v4 version 22.2.0 cannot resolve FragmentActivity
I had the exact same problem. Latest everything, reset cache, could NOT resolve v4. Funny thing.. run a build (Ctrl+F9), and suddenly the 'sea of red' goes away. Expected that it wouldn't have built, but then it did.. sigh!
Related Topics
How to Set The Rounded Corner Radius of a Color Drawable Using Xml
Difference Between App-Debug.Apk and App-Debug-Unaligned.Apk
Android Word-Wrap Edittext Text
Margins of a Linearlayout, Programmatically with Dp
Onclick Method Not Working Properly After Nestedscrollview Scrolled
How to Bypass The Firebase Cache to Refresh Data (In Android App)
Help with a Custom View Attributes Inside a Android Library Project
Set Visibility of Progress Bar Gone on Completion of Image Loading Using Glide Library
Check for Access to Notifications Using Notificationlistenerservice
How to Use a Library Project in Android Studio
How to Get Total Ram Size of a Device
View Pager + Imageview +Pinch Zoom + Rotation
Make Android Webview Not Store Cookies or Passwords
Android API 23 Change Navigation View Headerlayout Textview
Camera Preview Stretched on Few Android Devices
Impossible to Rotate The Emulator with Android 4.4