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

Eclipse not opening

Whenever I try to open Eclipse it gives me a message that it is not compatible with the version of Windows I am running. Does anyone know how to fix it?

8 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

This has been a problem lately. Your best bet is to probably switch to the bundle provided on the Android developer's site. When we refresh the Crystal Ball project we will switch to that as well. Perhaps this older Forum post might help: https://teamtreehouse.com/forum/problems-installing-windows-32bit-android-sdk

I downloaded the Google package and it's working for me. Thank you for helping.

Do I have to use the emulator to view my app if I have an Android device? The emulator I got from the Google package will open but it does not load. I was a able to open it once after 30 minutes of waiting but have not been able to open it since. If I cannot use an Android device what are my other options??

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Using a device is generally your best bet for testing. There is also a new fantastic 3rd party editor called Genymotion that works wonderfully. I'm going to record a workshop about it in a few weeks.

This is what it says in the console tab:

[2013-12-04 14:04:14 - CrystalBall] ------------------------------ [2013-12-04 14:04:14 - CrystalBall] Android Launch! [2013-12-04 14:04:14 - CrystalBall] adb is running normally. [2013-12-04 14:04:14 - CrystalBall] Performing com.example.crystalball.MainActivity activity launch [2013-12-04 14:04:14 - CrystalBall] Automatic Target Mode: launching new emulator with compatible AVD 'android41' [2013-12-04 14:04:14 - CrystalBall] Launching a new emulator with Virtual Device 'android41' [2013-12-04 14:04:41 - Emulator] Failed to create Context 0x3005 [2013-12-04 14:04:41 - Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer. [2013-12-04 14:04:44 - CrystalBall] New emulator found: emulator-5554 [2013-12-04 14:04:44 - CrystalBall] Waiting for HOME ('android.process.acore') to be launched...

One more line in red letters:

[2013-12-04 14:06:02 - CrystalBall] emulator-5554 disconnected! Cancelling 'com.example.crystalball.MainActivity activity launch'!

Ben Jakuben
Ben Jakuben
Treehouse Teacher

The first thing I would try (if you haven't already) is resetting the adb, as described in this StackOverflow answer.

I got the emulator to open but when I try to open the crystal ball it says this:

Unfortunately, Crystal Ball has stopped working.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Sorry for the late reply - are you still having trouble? Do you get any more details in the Console or Logcat tabs?

this is what the logcat says:

01-14 22:20:56.587: D/AndroidRuntime(1649): Shutting down VM 01-14 22:20:56.587: W/dalvikvm(1649): threadid=1: thread exiting with uncaught exception (group=0xb4ab0b90) 01-14 22:20:57.107: E/AndroidRuntime(1649): FATAL EXCEPTION: main 01-14 22:20:57.107: E/AndroidRuntime(1649): Process: com.example.crystalball, PID: 1649 01-14 22:20:57.107: E/AndroidRuntime(1649): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.crystalball/com.example.crystalball.MainActivity}: android.view.InflateException: Binary XML file line #21: Error inflating class android.widget.Button 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.ActivityThread.access$700(ActivityThread.java:135) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.os.Handler.dispatchMessage(Handler.java:102) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.os.Looper.loop(Looper.java:137) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.ActivityThread.main(ActivityThread.java:4998) 01-14 22:20:57.107: E/AndroidRuntime(1649): at java.lang.reflect.Method.invokeNative(Native Method) 01-14 22:20:57.107: E/AndroidRuntime(1649): at java.lang.reflect.Method.invoke(Method.java:515) 01-14 22:20:57.107: E/AndroidRuntime(1649): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) 01-14 22:20:57.107: E/AndroidRuntime(1649): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) 01-14 22:20:57.107: E/AndroidRuntime(1649): at dalvik.system.NativeStart.main(Native Method) 01-14 22:20:57.107: E/AndroidRuntime(1649): Caused by: android.view.InflateException: Binary XML file line #21: Error inflating class android.widget.Button 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.view.LayoutInflater.createView(LayoutInflater.java:620) 01-14 22:20:57.107: E/AndroidRuntime(1649): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 01-14 22:20:57.107: E/AndroidRuntime(1649): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.Activity.setContentView(Activity.java:1928) 01-14 22:20:57.107: E/AndroidRuntime(1649): at com.example.crystalball.MainActivity.onCreate(MainActivity.java:23) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.Activity.performCreate(Activity.java:5243) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140) 01-14 22:20:57.107: E/AndroidRuntime(1649): ... 11 more 01-14 22:20:57.107: E/AndroidRuntime(1649): Caused by: java.lang.reflect.InvocationTargetException 01-14 22:20:57.107: E/AndroidRuntime(1649): at java.lang.reflect.Constructor.constructNative(Native Method) 01-14 22:20:57.107: E/AndroidRuntime(1649): at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.view.LayoutInflater.createView(LayoutInflater.java:594) 01-14 22:20:57.107: E/AndroidRuntime(1649): ... 24 more 01-14 22:20:57.107: E/AndroidRuntime(1649): Caused by: android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x12/d=0x0 a=2 r=0x7f080001} 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.content.res.Resources.loadColorStateList(Resources.java:2237) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.content.res.TypedArray.getColorStateList(TypedArray.java:343) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.widget.TextView.<init>(TextView.java:959) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.widget.Button.<init>(Button.java:107) 01-14 22:20:57.107: E/AndroidRuntime(1649): at android.widget.Button.<init>(Button.java:103) 01-14 22:20:57.107: E/AndroidRuntime(1649): ... 27 more 01-14 22:21:17.647: I/Process(1649): Sending signal. PID: 1649 SIG: 9

Ben Jakuben
Ben Jakuben
Treehouse Teacher

Up near the top we get this bit:

Unable to start activity ComponentInfo{com.example.crystalball/com.example.crystalball.MainActivity}: android.view.InflateException: Binary XML file line #21: Error inflating class android.widget.Button

which seems to indicate an error in your XML layout file. Can you post the code for activity_main.xml in here?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="top"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:scaleType="fitCenter"
        android:src="@drawable/ball01" />

    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:text="Enlighten Me!"
        android:textColor="@id/button1"
        android:textSize="24sp"
        android:textStyle="bold|italic"
        android:typeface="serif" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:weightSum="0.2" >

        <View
            android:id="@+id/view1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.2" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.6"
            android:gravity="center_horizontal"
            android:shadowColor="@android:color/white"
            android:shadowRadius="10"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#3f0f7f"
            android:textSize="32sp" />

        <View
            android:id="@+id/view2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.2" />

    </LinearLayout>

</RelativeLayout>
Ben Jakuben
Ben Jakuben
Treehouse Teacher

It looks like this line might be causing your trouble:

android:textColor="@id/button1"

This is trying to set the textColor attribute with an ID. If you remove that line or change it back to a color then hopefully it will compile and run for you. :)