0

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: This is screen from stickyListHeaders library:

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:

enter image description here

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()
    }
}
bakua
  • 13,704
  • 7
  • 43
  • 62
  • Is it giving you any errors on import? There ought to be something of interest in the Gradle console. – Scott Barta Jan 16 '14 at 20:12
  • Not a single error, only this kind of message: :libs/stickyListHeaders_lib:compileReleaseRenderscript UP-TO-DATE :libs/stickyListHeaders_lib:generateReleaseBuildConfig UP-TO-DATE :libs/stickyListHeaders_lib:mergeReleaseAssets UP-TO-DATE :libs/stickyListHeaders_lib:mergeReleaseResources UP-TO-DATE :libs/stickyListHeaders_lib:processReleaseManifest UP-TO-DATE :libs/stickyListHeaders_lib:processReleaseResources UP-TO-DATE :libs/stickyListHeaders_lib:generateReleaseSources UP-TO-DATE :libs/stickyListHeaders_lib:compileReleaseJava UP-TO-DATE – bakua Jan 17 '14 at 08:44
  • use `include ':libs:slidingMenu'` in this manner, I am not sure whether "/" is ok. Never tried that. – Piyush Agarwal Jan 17 '14 at 09:04
  • Still the same. Weird thing is that main module is ok, but modules in libs/ are not functional – bakua Jan 17 '14 at 09:49
  • all modules or just only the stickyheader ? what it says when you press alt+enter on any error to fix ? – Piyush Agarwal Jan 17 '14 at 09:58
  • all modules, it says Create class Context. It has to be an error in .idea folder, or .gradle or something like that. (Because I have backup of those folders from time when it worked. And when I replace them with old ones project is fixed. But I need to know why is this happening) – bakua Jan 17 '14 at 10:04
  • try this out http://stackoverflow.com/questions/19508649/android-studio-says-cannot-resolve-symbol-but-project-compiles – Mohamed Elwy Oct 31 '15 at 21:18

1 Answers1

1

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.

Piyush Agarwal
  • 25,608
  • 8
  • 98
  • 111
  • Thanks, SDK is pointed correctly. Lines are added before apply plugin. Also I cant download all libraries because some of them are my own. Worst part is that everything worked OK since yesterday, so it has to be some settings set wrong. – bakua Jan 17 '14 at 08:55
  • And in module settings when I click on my main app module, I see its detail (properties, signing, flavors etc). But when I click on some lib module I see nothing of that – bakua Jan 17 '14 at 08:55
  • Could you please include your project structure in question also the top project level `build.gradle` file ? – Piyush Agarwal Jan 17 '14 at 09:01
  • I could not see the image for project structure in my office, i would suggest you to delete all things related to stickyheader and only include dependency which i mentioned in my answer. – Piyush Agarwal Jan 17 '14 at 09:12
  • I've added top level build.gradle as requested. Anout include dependency only - how does that work? It gets code from some global repository or from where? – bakua Jan 17 '14 at 09:53