udacity / ud845-Pets

Other
240 stars 717 forks source link

Importing differences #16

Closed marcio-b closed 4 years ago

marcio-b commented 7 years ago

I have the same imports that the ones showed here but in the lesson it says that i should have imported import android.support.v7.app.LoaderManager; import android.support.v7.content.CursorLoader; import android.support.v7.content.Loader; import android.support.v7.widget.SimpleCursorAdapter; but when i do, i get the "cannot resolve symbol " error.

I think i should compile something in the gradle files, but i'm not sure, and also I don't know how exactly. Would anyone help me with this?

Thanks in advance.

Mayur1496 commented 7 years ago

Can you please specify which class or method is displaying "cannot resolve symbol".

marcio-b commented 7 years ago

thanks for your response @Mayur1496. I am getting this errors on the import statement itself. androidstudio

When i position the caret above the red lines, the "cannot resolve symbol" error appears.

ghost commented 7 years ago

Make sure that you have this dependency in your build.gradle file under dependecies:

compile 'com.android.support:appcompat-v7:26.0.0-alpha1'

This is the current latest version of support library. So you might get an error if you are not using compileSdkVersion 26.

This is how my whole build.gradle file looks like:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.1'

    defaultConfig {
        applicationId "com.example.android.pets"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.android.support:design:26.0.0-alpha1'
}
marcio-b commented 4 years ago

I'm really really sorry for so much time with no answer, my carreer took me in another direction and I was not able to continue with this. I'm sure this is already very outdated and maybe obsolete. So I'm sugesting to close this issue. I want to thank everyone who took time to reply and apologize again for the delay.

nano-fruit commented 4 years ago

getSupportLoaderManager

instead of getLoaderManager() solves the issue, don't worry even if it says it's deprecated. It just works.