简体   繁体   中英

android studio doesn't see sdk

I today updated sdk as studio suggest, after that in such code

import android.app.Fragment;

    public class TaskFragment extends Fragment {

it show Fragment in red, and show hint Cannot resolve symbol 'Fragment' , but Build->Make Project without problem, how can I fix this issue?

.AndroidStudio2.3/system/log/idea.log rather big, so I post only error:

ERROR - aemon.impl.PassExecutorService - Accessing invalid virtual file: file:///home/xxx/Android/Sdk/sources/android-25; original:101; found:- 
com.intellij.openapi.vfs.InvalidVirtualFileAccessException: Accessing invalid virtual file: file:///home/xxx/Android/Sdk/sources/android-25; original:101; found:-

directory /home/xxx/Android/Sdk/sources/android-25 exists

Following points may help you to solve this error.

  • Go to File -> Invalidate Caches... , and select " Invalidate and Restart " option to fix this and then rebuild project again.
  • Make sure that your build.gradle file has:

     dependencies { compile "com.android.support:support-core-utils:25.4.0" } 
  • Set correct path for SDK .
  • Synchronize project manually by clicking the Sync Project with Gradle Files button in the toolbar.

Check SDK location is OK or not.

File >> Project Structure >> SDK Location >> C:\\Users\\You PC Name\\AppData\\Local\\Android\\Sdk

Thanks to @abhishek I find root of problem - /home/xxx/Android/Sdk/sources/android-25 , so I removed SDK Platfrom -> Android 7.1.1 and installed it again. And now Android IDE again can found Fragment .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM