android - R.java has been generated, still getting 'cannot be resolved to be a variable' -
i'm thinking might have packages, can't find error. there no errors(red marks) in xml files, , drawables , xml files conform naming convention. have tried cleaning project, , there no import r.java anywhere.
the classes cannot find r.java is:
com.datafetcher.main.menu.java com.datafetcher.showperson.mainactivity.java com.datafetcher.showperson.displaymessageactivity.java
in android manifest have declared:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.datafetcher" ...
and activities declared:
<activity android:name=".main.menu" android:label="@string/title_activity_display_message"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".showperson.mainactivity" android:label="@string/app_name" android:parentactivityname="com.datafetcher.main.menu" > </activity> <activity android:name=".showperson.displaymessageactivity" android:label="@string/title_activity_display_message" android:parentactivityname="com.datafetcher.main.menu" > </activity>
my r.java generated gen/com.datafetcher.r.java. why can't use in code?
this nice 5 second edit. supposed import com.datafetcher.r? tried reason, , works. have never done before, assumed done implicitly somehow.
sometimes happens when import r different package. example, copy text 1 project in eclipse, com.example.foo package, , eclipse inserts import directive package's r. generated r belongs package. in case have delete bad import.
by way, see all resource ids not found or of them? (in same file, in different files?)
one more possibility application package , activity package different. in case need , explicit import statement.
in case, classes com.datafetcher.r
, com.datafetcher.main.menu
belong different packages, namely, com.datafetcher
, com.datafetcher.main
. in java, classes see other classes in same package without explicit importing, classes in different packages visible after import them.
Comments
Post a Comment