packages/apps/Myfolder/src/com/android/myfolder/MyFile.java:196: package R does not exist
addPreferencesFromResource(R.xml.myfile);
^
packages/apps/Myfolder/src/com/android/myfolder/MyFile.java:344: package R does not exist
menu.add(0, MENU_SAVE, 0, R.string.menu_save)
^
packages/apps/Myfolder/src/com/android/myfolder/MyFile.java:346: package R does not exist
menu.add(0, MENU_CANCEL, 0, R.string.menu_cancel)
^
packages/apps/Myfolder/src/com/android/myfolder/MyFile.java:454: package R does not exist
errorMsg = mRes.getString(R.string.error_empty);
^
packages/apps/Myfolder/src/com/android/myfolder/MyFile.java:458: package R does not exist
errorMsg = mRes.getString(R.string.error_empty);
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You can try import packagename.R;
In my case, this error occurred because I had changed the package name of the app (before publishing to Google Play, of course), but I forgot to update the
package
attribute of themanifest
element in myAndroidManifest.xml
file. Once thepackage
attribute agreed with the new package name, the error went away.If you are building from an ant script, you must run aapt. See the "-resource-src" target in $SDK_DIR/tools/ant/main_rules.xml.
Check if there are any errors in your resource files or any missing dependencies. Either of these will cause the R.java class to not be code-generated and thus a lot of errors like the ones you have shown.
Make sure you have: package 'YOUR PACKAGE NAME' in java file that calls R class
Also make sure to include your current Activity in the AndroidManifest.xml, inside the application tags. So if MyFile is your Activity subclass, you should have something like this in it:
Although what's actually in there depends on your activity. More information about this at: http://developer.android.com/guide/topics/manifest/manifest-intro.html