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

Ibrahim Mahmoud
PLUS
Ibrahim Mahmoud
Courses Plus Student 1,332 Points

Code Ninjas help pls

"Your project contains errors, pls fix them before running your application"

I get the above message trying to run Crystalball app . There is an error with my "Strings" under "Values" showing the below:

<?xml version="1.0" encoding="utf-8"?>

<string name="app_name">Crystal Ball</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>

The error messages are as follow: 1."app_name" is not translated in af, am, ar, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms-rMY, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu

2.Multiple annotations found at this line: - The resource R.string.hello_world appears to be unused - "hello_world" is not translated in af, am, ar, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms-rMY, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu

3.action_settings" is not translated in af, am, ar, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms-rMY, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu

HELP PLS!

5 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

What you've listed are warnings that should not prevent you from running your app. But if it's saying your project contains errors, there must be another error causing you trouble. Can you see if any other errors appear in red in your "Problems" tab at the bottom of Eclipse?

Ibrahim Mahmoud
PLUS
Ibrahim Mahmoud
Courses Plus Student 1,332 Points

Hi Ben:) Below list of problems I'm facing:

1."app_name" is not translated in af, am, ar, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms-rMY, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu strings.xml /CrystalBall/res/values line 4 Android Lint Problem

  1. "hello_world" is not translated in af, am, ar, bg, ca, cs, da, de, el, en-rGB, en-rIN, es, es-rUS, et-rEE, fa, fi, fr, fr-rCA, hi, hr, hu, hy-rAM, in, it, iw, ja, ka-rGE, km-rKH, ko, lo-rLA, lt, lv, mn-rMN, ms-rMY, nb, nl, pl, pt, pt-rPT, ro, ru, sk, sl, sr, sv, sw, th, tl, tr, uk, vi, zh-rCN, zh-rHK, zh-rTW, zu strings.xml /CrystalBall/res/values line 5 Android Lint Problem

  2. Attribute is missing the Android namespace prefix abc_search_dropdown_dark.xml /appcompat_v7/res/drawable line 19 Android Lint Problem

  3. Attribute is missing the Android namespace prefix abc_search_dropdown_light.xml /appcompat_v7/res/drawable line 19 Android Lint Problem

5.This class should be public (android.support.v7.internal.widget.ActionBarView.HomeView) CrystalBall line 1 Android Lint Problem

6.Wrong orientation? No orientation specified, and the default is horizontal, yet this layout has multiple children where at least one has layout_width="match_parent" abc_action_bar_decor_overlay.xml /appcompat_v7/res/layout line 25 Android Lint Problem

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Do these show up as yellow warnings or red errors?

Ibrahim Mahmoud
PLUS
Ibrahim Mahmoud
Courses Plus Student 1,332 Points

This is the shape of my code, I'm supposed to get "Yes", "No", "Maybe" for clicking on my "Enlighten Me" Button.

package com.example.crystalball;

import java.util.Random;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


public class MainActivity extends ActionBarActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

      // Declare our view variables and assign them the views from the layout file  
      final TextView answerLabel = (TextView) findViewById(R.id.textView1);
      Button getAnswerButton = (Button) findViewById(R.id.button1); 

      getAnswerButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {    
        String answer = "";

        //Randomly select one of three answers: Yes, No, or Maybe
        Random randomGenerator = new Random(); //Construct a new Random number generator
        int randomNumber = randomGenerator.nextInt(3); 

        /* Convert the randomNumber to a text answer
         * 0 = Yes
         * 1 = No 
         * 2 = Maybe
         */

        //if a randomNumber equal 0 then
        if(randomNumber == 0) {
          // set answer equal to Yes
            answer = "Yes";
        }
        else if(randomNumber == 1) {
              // set answer equal to Yes
                answer = "No";
            }
        else if(randomNumber == 2) {
              // set answer equal to Yes
                answer = "Maybe";
            }
        else {
            answer = "Sorry, there is an error"; 
        }

        //Update the label with our dynamic answer 
        answerLabel.setText(answer);
        }
    });
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

}
Ben Jakuben
Ben Jakuben
Treehouse Teacher

Okay, can you zip up your project and email it to help@teamtreehouse.com? Ask them to forward it to me and I'll take a look.

Ibrahim Mahmoud
PLUS
Ibrahim Mahmoud
Courses Plus Student 1,332 Points

Hi Ben thanks first as you unveiled another nice feature of treehouse (support) I took the "uneasy" way of trying to write the code from the start and it worked so no need to send you anything. Thanks again for your reply...

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Cool - that's a great way to solve it! :)