Reputation: 498
I'm trying to get Android studio to recognise IDs of various views etc. in my layout.xml file. When I was inputting the code in the xml, everything seemed OK, but when I revisited my code today, the ids in the layout file were in red saying "cannot resolve symbol."
When I tried to access the view (eg using "view.findViewById(R.id.splo)"), it says it cannot resolve the symbol (in this case "splo").
I'm not doing anything radical, for instance this is how I define splo in my layout xml:
<TextView android:id="@+id/splo" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="" />
Doing some digging, I found that I don't have a res/values/id.xml file - and looking further I don't have anything below app/build/generated/source, so no R.java file either.
I've looked at some people's requests for help - one was very similar to mine ("cannot resolve symbol R" in Android Studio) but the solutions offered don't help.
I've done multiple invalidate cache and restart, with or without Build->clean project and nothing works, and the IDs are still not recognised. Can anyone help?
Upvotes: 2
Views: 3263
Reputation: 106
Well there might be potential errors in the package name when you are building your application.
Since you mentioned, you already tried rebuilding and cleaning the project, we won't waste time doing that again!
YOUR_PACKAGE_NAME
.YOUR_ACTIVITY_NAME
"] is correctly assignedYOUR_ACTIVITY_NAME
]", then bring it in the above format by adding the package name before the dot.The problem should be solved and if not my request is that please Upload your AndroidManifest.xml file and your package information so that I can have a better look at the issue
Upvotes: 2