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 The Options Menu

Current Configuration Settings for Android Bumble Bee (2022)

I was able to get the project to run by doing the following:

  1. Installing the Java 8 SDK
  2. Creating a new project with an Empty Activity and a minimum SDK of 25
  3. Adding the following lines of code from the Glide documentation to my build.gradle(module) file xml implementation 'com.github.bumptech.glide:glide:4.13.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
  4. Downloading the project from Github
  5. Copying the images into the project I created
  6. Copying the ImageView from activity_main.xml into the project I created. You only want to copy the ImageView. The constraintlayout format has changed. If you copy the entire file, you'll break your code.
  7. Copying everything inside the MainActivity class inside the MainActivity class of the new file. Again, you don't want to copy the class declaration or any of the imports. Android has changed where these resources are found.
  8. If you don't have Android Studio set to optimize imports, you'll need to go through and import the relevant classes.

Here's a look at my build.gradle(Module) file

plugins {
    id 'com.android.application'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.treehouse"
        minSdk 25
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'com.github.bumptech.glide:glide:4.13.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
}

Here is my build.gradle(Project) file

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
}

//repositories {
//    google()
//    mavenCentral()
//}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Hope this helps!

1 Answer

Thank you so much! Could you show what you put for 'main activity.java' since im having trouble getting rid of some of the errors!