Skip to content
Advertisement

Android studio can’t find ArrayList class

First of all I’ve been using Android studio for quite years but this has never happened before.

It seems like android studio’s inner ArrayList class has vanished out of a sudden. I can’t use ArrayList. It always says Can’t find symbol ArrayList

I’ve cleaned rebuild and even invalidated caches and restarted several times but all in vain.

package dev.moutamid.testapp;


import java.util.ArrayList; //<--- this gives error


public class FragmentDashboard extends Fragment {


    private ArrayList<refUser> refUsersList = new ArrayList<>(); //<--- and this line
}

My android studio is up to date. I then opened a new project and tried to use ArrayList but it was still not showing. Feels like there’s nothing related to ArrayList in studio.

Yesterday I got BSOD (Blue screen of death of Windows) and today it’s happening. I’m using git repository to backup my project.

What could be the solution? I think Git has deleted ArrayList class because it already had corrupted several files before. I got luck due to the backups.

Advertisement

Answer

Well this is really weird. Would suggest you to try the following:

  1. Check the jdk in android studio and check the path. If you still facing this problem then install a fresh jdk which you download online and put in the new path and try.
  2. If this is also not working, back up all files and reinstall Android studio. Uninstall the current copy and install a fresh one.
  3. Well since you have had a Blue screen issue, would highly recommend to do a fresh install of windows. You haven’t specified which Windows version you using so I am assuming you are using Windows 10. This link should help you out for Windows 10 : https://support.microsoft.com/en-in/help/4000735/windows-10-reinstall
  4. And please keep taking a backup of whatever you need regularly.
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement