javaandroiddji-sdk

Android java class/symbol not found despite being placed in the same directory


I have encountered issues in my android studio regarding java classes/symbols not found, despite these classes and symbols being placed in the same directory, or under the same parent directory. I am making use of the DJI's mobile SDK for android.

Example of errors:

Cannot resolve symbol 'DJISampleApplication'

For illustration, here are 2 screenshots First example. Clicking on "import class" causes android studio to create a brand new class instead of linking it to the existing one. Example of class not found

second example Multiple classes not found

However, oddly, when I go under "Build >> Make Project" , or "Run" to deploy on a real android device, the app can be installed, and there are no errors (only warnings).

Things I have tried:

  1. Uninstalling and re-installing android studio
  2. copying the whole project from the original files in again
  3. Trying on another computer, which works. However, as i am only assigned this pc, i have to get this to work here as well.

Thank you in advance !


Solution

  • Your best bet is to invalidate caches and restart. Solves 99% of problems like this for me.

    enter image description here

    You can also try to reimport the project using the gradle tool window ...

    Click the reload button here ...

    enter image description here