Development issue/problem:
I recently created a pot library file that I imported into my Android project. I can call functions and use classes that are present in this jar, but Android Studio tells me it can’t solve the class symbol I use. See the screenshot below:
Click here for a full-size image
The code is built and successfully implemented. The isThisThingWorking() function simply returns where, and that’s exactly what the boolean blah-blah is set to.
I tried to click on Sync Project with Gradle Files and the option Invalidate Caches / Restart… in Android Studio’s File menu, but none of this solved the problem. What can I do to prevent the Android Studio IDE from not fixing the xxxSDK error?
How can I solve this problem?
Solution 1:
I encountered this problem when IntelliJ IDEA was suddenly shut down due to an operating system crash.
You can choose File -> Invalid Cache… and select Invalid and restart to correct it.
Solution 2:
I found the problem – my SDK.jar wasn’t generated correctly. It contained .java files instead of .class files. This explains why the IDE could not find the SDK class. The structure of the package was still correct in the bank, so the name of the package itself is not red. The code worked correctly because the compiler knew he had to compile .java files.
To solve this problem, I adapted my build.gradle SDK project to include .class files instead of .java files when building the pot. The inclusion of this new pot instead of the old one solved the BDI problem.
EDIT: For most people, Sentil’s answer would be more appropriate. I let this be the generally accepted answer, because it has solved my specific problem.
Solution 3:
Try adding the library to the project structure.
Choose File -> Project structure from the menu. Select the Libraries option and press the green + to add your library.
Solution 4:
This always happened to me after I changed branches in my current project: a lot of absurd eros reported by the IDE.
The solution is to modify and force build.gradle to synchronize.
Solution No 5:
This problem is regularly generated in the android 3.1. I’ve tried everything I can think of. However, the problem was solved when I deleted the .gradle and .idea files and started Android Studio.
Android Studio will again create a .idea and .gradle file for your project. Then click to synchronize the project with a fence. Now everything’s working fine.
Solution No 6:
Changing the voice injection settings worked for me.
Place the cursor over one of the red underlined codes and press Alt + Enter.
Now select Language Injection Settings and the window below will appear.
Make sure you have selected the correct file type in the ID: field and deselect the options associated with your error codes, then click OK.
I hope that helps somebody.
Solution No 7:
Try the following steps:
- Close the project and then delete the /.idea project from the project folder.
- Also delete the /.degree folder
- Noel selects the option File in the menu on the top left in android studio.
- Select an option : Invalid cache/restart A dialog box opens
- Press the first button with : Invalid and reset
After trying out the above options, everything should work well.
Solution No 8:
I was just at work
File -> Open -> and click build.gradle to open the project again.
Solution No 9:
It worked for me:
Go to File -> Synchronize Project with Cradle Files.
Good luck!
Related Tags:
cannot resolve symbol android studio,android studio 3.6 cannot resolve symbol,android studio 3.4 cannot resolve symbol,cannot resolve symbol override,cannot resolve symbol java android studio,cannot resolve symbol unityplayeractivity,import com-android build-outputfile cannot resolve symbol 'android,cannot resolve symbol in