简体   繁体   English

Android Studio模块无法解析符号上下文

[英]Android studio module cannot resolve symbol context

I had a project in Android studio and I needed to delete .idea directory. 我在Android Studio中有一个项目,我需要删除.idea目录。 So I importet it again, but after this, all modules in libs/ can't resolve anything from android (but app module can). 因此,我再次导入它,但是在此之后,libs /中的所有模块都无法从android解析任何内容(但app模块可以)。

Is there any setting which connects module with android? 是否有将模块与android连接的设置?

Thanks very much 非常感谢

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

biuld.gradle from stickyList: apply plugin: 'android-library' 来自stickyList的biuld.gradle:应用插件:“ 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 和项目的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: 顶级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. 首先检查文件»项目结构»Android SDK是否指向正确的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. 确保在apply plugin: 'android-library'之前添加以下行apply plugin: 'android-library'build.gradle apply plugin: 'android-library' build.gradle文件中或Project根目录的build.gradle文件中。

 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. 我的建议是避免将库下载和添加到项目中,而应使用maven依赖项。

For stickyheader which you have used can be used just by adding dependency like this in your module's build.gradle file 对于您使用过的build.gradle在模块的build.gradle文件中添加如下所示的依赖项即可使用

 dependencies {

    compile 'se.emilsjolander:stickylistheaders:2.1.3'

 }

Nothing else needs to be done. 不需要做其他任何事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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