A strange problem came from no where.

The project worked fine and suddenly in all classes where such import was used

import android.support.v4.app.ActivityCompat; 

Begin to show that he cannot recognize what it is ...

Checked .gradle there everything is fine

 compile 'com.android.support:support-v4:24.2.1' 

Made a project rebuild, closed the studio opened ... Nothing helps ...

In the lines where I used this class, because here for example

 ActivityCompat.checkSelfPermission(activity.getApplicationContext(), permission) == PackageManager.PERMISSION_GRANTED) 

now when you press Alt + Enter offers to add a library

 import android.support.v13.app.ActivityCompat; 

Who can tell what's going on here? Why not see the right library?

  • Probably Google updated any support and rendered this class in v13. And you have updated all the support and now your class is in another lib. In theory, you need the same as the studio offers to connect the compile 'com.android.support:support-v13:24.2.1' - YuriySPb
  • @Yuriy SPb Yes, but there is no this checkSelfPermission() method that I use ... And besides, I did not update the version number ... But still, I just tried to lower the version number by 2 and still the same error .. - Aleksey Timoshchenko
  • Hmm ... Strange ... Maybe your studio is the last and you found another bug in it? Try Invalidate cache and restart studios to do and \ or install an older version of the studio - YuriiSPb
  • See more here. stackoverflow.com/questions/33407250/… Maybe you should try PermissionChecker.checkSelfPermission and / or surround these lines with checks for the current version of the axisYuriSPb
  • @ YuriiSPb yes it can, but then why when I roll back a couple of git tag back then everything is building ... - Aleksey Timoshchenko

1 answer 1

I switched from branch to branch again, made a rebuild and order ... But when I wrote git status it showed that such a .idea / vcs.xml file was modified ... Strange things are happening here))

In this file this line was duplicated.

 <mapping directory="$PROJECT_DIR$" vcs="Git" /> 

now the file looks like this

 <project version="4"> <component name="VcsDirectoryMappings"> <mapping directory="$PROJECT_DIR$" vcs="Git" /> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> </component> </project> \ No newline at end of file 

Honestly, I don't even know why this file is needed ...

  • In general, all the files from .idea should be added to the ignore) I think it would be nice if you add here or to the question what exactly has changed there - it may be clear what the problem was) - YuriySPb
  • So this file was probably ignored, I saw it for the first time in those monitored ... Added changes to the response - Aleksey Timoshchenko