I followed the Hello, Testing tutorial to the letter.
Yet, the following line produces a “com.example.helloandroid.R.id cannot be resolved” error:
mView = (TextView) mActivity.findViewById(com.example.helloandroid.R.id.textview);
Eclipse amazingly suggests 2 quick fixes:
- Create field ‘id’ in type ‘R’
- Create constant ‘id’ in type ‘R’
Can you help me understand what these fixes mean? Are these really the correct fixes? (why didn’t the tutorial provide them, too?)
In HelloAndroid project, HelloAndroid.java
Check your HelloAndroid project, in “gen->com.example.helloandroid->R.java” have the following code like:
if no, check “res->layout->main.xml”. there is “android:id=”@+id/textview” as follows?
check these items, fix your HelloAndroid.java and/or main.xml if needed.
rebuild HelloAndroid project, and rebuild HelloAndroidTest project.