Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
roolip roolip
299 PointsSDK update lead to errors
I successfully completed running my app until i updated my SDK. I started receiving errors in my source code that weren't there before, such as:
'cannot return a value from a method with void result type'; symbols that are expected ')' or ';' unexpected token; 'cannot resolve symbol item' - which i think i didn't create, rather it came automatically upon the creation of the project; 'variable listener is accessed from within inner class, needs to be declared final' 'annotations are not allowed here' - red error line beneath the override, which did came automatically.
I tried looking online and didn't find the answer. one advice was to delete the app/build and make gradle rebuild it. but the rebuild failed due to: 'error identifier expected'; 'symbol ; is expected'; 'error reached end of file while parsing'; 'execution failed for task app:compileDebugjava'. This problem is delaying my progress in treehouse.
Thanks in advance.
2 Answers
william parrish
13,774 PointsEverything you just posted leans towards you being short a } somewhere. Also, check your methods and see if you are actually trying to return a value in a method marked with void, you cannot do that.
If you post your code here, i'll fix it for you.
william parrish
13,774 PointsBetween these two lines
showFactButton.setOnClickListener(listener);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Add another closing bracket, right after the first one. So it should look like this
showFactButton.setOnClickListener(listener);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Essentially, add another '}' between showFactButton.setOnClickListener
and onCreateOptionsMenu.
roolip roolip
299 Pointsroolip roolip
299 Pointspackage com.example.FunFactsi.funfacts;
import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView;
import java.util.Random;
public class FunFactsActivity extends Activity {
}