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 trialtirupathi rao
381 PointsI am using android studio 2.3.3. To declare view variables using 'var' keyword. It is not supporting.
in MainActivity
private var factTextView: TextView? = null
error - cannot resolve symbol var error - : error - ? = null
1 Answer
Seth Kroger
56,414 PointsIn 2.3 you probably didn't have the checkbox on the New Project dialog to configure for Kotlin at the start. In the menu at the top click Tools -> Kotlin -> Configure Kotlin in Project -> Android and Gradle. Then do a Gradle Sync. If your Activity is a Java file (the name ends in .java instead of .kt) go to the Menu and click Code -> Convert Java File to Kotlin File (should be at the bottom)
tirupathi rao
381 PointsThanks I will try
Calin Bogdan
14,921 PointsCalin Bogdan
14,921 PointsHi!
Could you please give us a copy of your code so we can check it out? It would be great and would help us solve your problem faster.
Thanks!