Android Studio resource file missing

1.4k Views Asked by At

I want to create a listview with a simple list item in android studio, and as we all know we write android.R.simple_list_item_1.

However, my problem is that when I type android. , I don't get in the suggestions the "R", I tried typing completing it manually and typing android.R. , but I don't get suggestions for list items and I get an error.

I checked my android sdk and java sdk paths and they're correct.

Why is the android resource file missing from the suggestions??

2

There are 2 best solutions below

0
Simar On

It is

android.R.layout.simple_list_item_1
0
Robin Dijkhof On

First make sure your class imports YOUR.PACKAGE.NAME.android.R

Second you need a first build inorder to have android.R file. Check if you have this file and if you haven't build your project. I believe building is called Sync Gradle in android studio.