I am using ADT 23.0.2. I just imported the google-play library to my workspace and added the reference to it in my project.
Now nowhere in my project the resource ids can be recognized because there is no R file. (Anywhere I have R.id.blah I get the error "R cannot be resolved to a variable);
It's just gone. What am I supposed to do? I exactly followed the steps by developers.google.com. It's nothing complicated but I don't know why this happened.
(I have all layout files in place and no import for android.R are in my class files.)
Before adding the Tools I use:
Here are screenshots from my app properties:
My manifest
<permission android:name="com.appname.appname4.MAPS_RECEIVE" android:protectionLevel="signature"> </permission> <uses-permission android:name="com.appname.appname4.MAPS_RECEIVE"/>
<activity android:name="com.appname.appname4.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.appname.appname4.SearchResultListActivity" android:label="@string/title_activity_search_result_list" android:parentActivityName="com.appname.appname4.MainActivity" > <!-- Parent activity meta-data to support 4.0 and lower --> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.appname.appname4.MainActivity" /> </activity> <activity android:name="com.appname.appname4.ContactInfoActivity" android:label="@string/title_activity_property_detail" android:parentActivityName="com.appname.appname4.SearchResultListActivity"
>
</manifest>
I had similar issues when I first started Android programming. Here are some fixes that worked for me in the past.
Many times a R file not being generated is due to an issue with your layout file or Android Manifest file. Follow this link and work your way down the page checking permissions and the general layout format.
go to Project->Clean. Also make sure you have selected the option to build project automatically .(Without this option check marked R file is never generated automatically).
Right click on your project in Package explorer then choose fix project properties . Repeat Step 1 after this.
Go to Project->Properties then Builders . Select the appropriate boxes. Repeat Step 1, and Clean and rebuild project.
Sometimes to fix errors associated with installing these two reference libraries. I copy there folders into a generic library folder on my hard(where I keep most of my eclipse reference libraries), after this I delete them from the Package explorer and from the "default" directory where they were installed. I Fix project properties again and clean/rebuild. This should get you back to your non-reference library version of the package. Then I manually add them as Projects to my eclipse IDE and finally follow this to add them as references to my project. Then fix project properties,clean and rebuild.
Finally, referring to this StackOverflow page has helped me countless times. And one way or another fixed my issue.
Good Luck.
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.