devapps123
Apple Fan
Profile
Posts: 50
Reg: Jul 12, 2012
Sarasota, FL
500
01/26/13 04:22 AM (12 years ago)

R cannot be resolved to a variable....NOW emulator shutting down app

Getting the error "R cannot be resolved to a variable" about 497 times in eclipse. All files are lower case. API is correct. Have done "clean/build" multiple times. If there's something more advanced that needs to be fixed in the coding a beginner-friendly explanation of how to fix it would be great.
 
Sandeep
Android Fan
Profile
Posts: 1260
Reg: Feb 01, 2012
Miraj, India
25,250
like
01/26/13 04:35 AM (12 years ago)
I think you are not using the google api 2.2 thats why you are getting this error. Try this, right click your project file--> select Properties--> select Android-->now in project build traget select target name to google api 2.2. and click ok
 
Suvinay pawa
buzztouch Evangelist
Profile
Posts: 599
Reg: Aug 01, 2012
location unknow...
9,890
like
01/26/13 04:56 AM (12 years ago)
If that doesn't work although it will try cleaning yur project in the project properties
 
devapps123
Apple Fan
Profile
Posts: 50
Reg: Jul 12, 2012
Sarasota, FL
500
like
01/26/13 10:57 AM (12 years ago)
Thanks for the replies. I am using the correct API and the project has been cleaned and rebuilt several times. Any other suggestions?
 
Joe Sprott
Code is Art
Profile
Posts: 414
Reg: Aug 20, 2011
Melbourne, FL
10,290
like
01/26/13 11:11 AM (12 years ago)
look at the error in the console. I just had the same problem and the error was do to using a plugin from buzz touch mods. I deleted every plugin that was not downloaded from buzztouch.com and recompiled and I was error free. here is the thread from my problems https://www.buzztouch.com/forum/thread.php?tid=BA6441EC8AC63432E2B956E
 
Joe Sprott
Code is Art
Profile
Posts: 414
Reg: Aug 20, 2011
Melbourne, FL
10,290
like
01/26/13 11:12 AM (12 years ago)
if thats not the problem post a screenshot of the code or console
 
devapps123
Apple Fan
Profile
Posts: 50
Reg: Jul 12, 2012
Sarasota, FL
500
like
01/26/13 02:26 PM (12 years ago)
Thanks, everyone. I've managed to solve the original issue by doing several things including deleting a plugin and changing some file names (tip for anyone experiencing issues, you cannot use an "_" underscore immediately before or after a number in your file names). So now I have a new roadblock. When I try to launch the app in the emulator, I will see a screen from the app for a few seconds and then its saying that the app "quits unexpectedly." I have already... 1. Checked, deleted, reloaded and checked the AVD again 2. Shut down the program and my computer and re-launched 3. Checked the "properties" of the project to ensure that the AVD checkbox is ticked in the settings Here's what the LogCat tells me... 01-26 15:04:44.246: E/AndroidRuntime(306): FATAL EXCEPTION: main 01-26 15:04:44.246: E/AndroidRuntime(306): java.lang.NullPointerException 01-26 15:04:44.246: E/AndroidRuntime(306): at com.agforandroid.BT_screen_quiz.showNextQuestion(BT_screen_quiz.java:1064) 01-26 15:04:44.246: E/AndroidRuntime(306): at com.agforandroid.BT_screen_quiz.startQuiz(BT_screen_quiz.java:994) 01-26 15:04:44.246: E/AndroidRuntime(306): at com.agforandroid.BT_screen_quiz$1.handleMessage(BT_screen_quiz.java:906) 01-26 15:04:44.246: E/AndroidRuntime(306): at android.os.Handler.dispatchMessage(Handler.java:99) 01-26 15:04:44.246: E/AndroidRuntime(306): at android.os.Looper.loop(Looper.java:123) 01-26 15:04:44.246: E/AndroidRuntime(306): at android.app.ActivityThread.main(ActivityThread.java:4627) 01-26 15:04:44.246: E/AndroidRuntime(306): at java.lang.reflect.Method.invokeNative(Native Method) 01-26 15:04:44.246: E/AndroidRuntime(306): at java.lang.reflect.Method.invoke(Method.java:521) 01-26 15:04:44.246: E/AndroidRuntime(306): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 01-26 15:04:44.246: E/AndroidRuntime(306): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 01-26 15:04:44.246: E/AndroidRuntime(306): at dalvik.system.NativeStart.main(Native Method)
 
devapps123
Apple Fan
Profile
Posts: 50
Reg: Jul 12, 2012
Sarasota, FL
500
like
01/26/13 02:28 PM (12 years ago)
I have also deleted and re-imported the source code.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/26/13 02:41 PM (12 years ago)
Start small, start fresh. Create an app. One or two screens. Test it. Add another screen. Test it. Don't add everything under the sun without understanding what it does. Cheers! -- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.