简体   繁体   中英

Android studio module cannot resolve symbol context

I had a project in Android studio and I needed to delete .idea directory. So I importet it again, but after this, all modules in libs/ can't resolve anything from android (but app module can).

Is there any setting which connects module with android?

Thanks very much

This is screen from stickyListHeaders library: 这是stickyListHeaders库的屏幕:

biuld.gradle from stickyList: apply plugin: 'android-library'

apply plugin: 'android-library'

android {
compileSdkVersion 17
buildToolsVersion "19.0.0"

defaultConfig {
    minSdkVersion 9
    targetSdkVersion 18
}

release {
    runProguard false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}

And project's settings.gradle

include ':libs/bakuDroidLibrary'
include ':libs/photoView'
include ':libs/pullToRefresh'
include ':libs/slidingMenu'
include ':libs/spinnerWheel'
include ':libs/stickyListHeaders_lib'
include ':##PROJECTNAME##'

Some other screenns which may help:

在此处输入图片说明

Top level build.gradle:

// Top-level build file where you can add configuration options common to all sub-     projects/modules.
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

First Check whether File » Project Structure » Android SDK is pointing to right SDK.

Than make sure below lines are added before apply plugin: 'android-library' inside build.gradle file of your stickyheader library or inside Project root's build.gradle file.

 buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }
}

My suggestion is to avoid downloading and adding libraries in to your project, use maven dependency instead.

For stickyheader which you have used can be used just by adding dependency like this in your module's build.gradle file

 dependencies {

    compile 'se.emilsjolander:stickylistheaders:2.1.3'

 }

Nothing else needs to be done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM