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

Android

Started Blog Reader Project, now Crystal Ball App has errors

Hi folks,

I completed the Crystal Ball App, (yay me!) and moved on to the Blog Reader App.

I downloaded the new development package from Google as instructed in the videos (I had been using the treehouse version that it tells you to use to build the Crystal Ball app) and put my crystal ball into the new workspace.

Now my Crystal Ball has errors. It was fine before I upgraded Eclipse.

In the console it says "Unable to resolve target 'android-16'

And in the file with my random answers it has a bunch of errors, but I don't know what is wrong or how to fix it.

here is the code

package net.johannson.thesuperpredictor;

import java.util.Random;

public class SuperPredictor { //Member variables (properties about the object) public String [] mAnswers = { "Booyah!", "No way", "Maybe", "I'm not going to tell you", "Yes, if you clean your room" };

//Methods (abilities: things the object can do)
public String getAnAnswer() {

    String answer = "";

    //Randomly select one of the answers
    Random randomGenerator = new Random(); //Construct a new Random number generator
    int randomNumber = randomGenerator.nextInt(mAnswers.length);

    answer = mAnswers[randomNumber];  

    return answer;

}

}

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

That error message means that your new bundle doesn't have the same SDK files that you had with your old bundle. It's a little confusing, especially since our older bundle is a little outdated. It's easy to fix, though. In the Blog Reader project we show you how to update your tools and get different versions of the SDK. It's around the 2:30 mark of this video: http://teamtreehouse.com/library/build-a-blog-reader-android-app/exploring-the-masterdetail-template/creating-a-project-using-the-masterdetail-template-2

Check that out and if you download API 16 then you should be okay. Alternatively, you could change the target SDK of your Eclipse project inside AndroidManifest.xml to match the API level that you have with the new bundle.

Hope this makes sense!

Thanks for your reply, Ben. I am just getting back to this after Christmas obligations ate up most of my free time :-)

I tried to change the target SDK but that did not seem to work. Perhaps I was not changing it in the right place. Then I downloaded the API 16 and that appears to have solved the problem.

Happy Holidays!