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 Build a Simple Android App with Kotlin Basic Android Programming Initializing a Button

Bummer! Error: Unable to access jarfile test.jar

I'm lost when it comes to this error message

FunFactsActivity.kt
import android.app.Activity
import android.os.Bundle
import android.widget.TextView
import android.widget.Button

class FunFactsActivity : Activity() {
  override fun onCreate(savedInstanceState: Bundle) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_fun_facts)

    // Declare our View variables and assign them the Views from the layout file
    val factLabel = findViewById(R.id.factTextView) as TextView
    val factLabel = findViewById(R.id.showFactButton) as Button

  }
}

1 Answer

Marco Flores
Marco Flores
7,971 Points

val showFactButton = findViewById(R.id.showFactButton) as Button

The name of the second variable is "showFactButton" not "factLabel"