user1244932
user1244932

Reputation: 8082

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

Upvotes: 1

Views: 2155

Answers (3)

user1244932
user1244932

Reputation: 8082

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.

Upvotes: 0

H.P.
H.P.

Reputation: 1221

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.

Upvotes: 2

tofa
tofa

Reputation: 69

Check SDK location is OK or not.

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

Upvotes: 2

Related Questions