Android的工作室表示,"不能解析符号"但项目编译 [英] Android Studio says "cannot resolve symbol" but project compiles

查看:238
本文介绍了Android的工作室表示,"不能解析符号"但项目编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进口twitter4j在AndroidStudio,用我的build.gradle如下:

I'm importing twitter4j in AndroidStudio, using the following in my build.gradle:

dependencies {
  compile 'com.android.support:support-v4:18.0.+'
  compile files('libs/twitter4j-core-3.0.4.jar')
}

该项目编译好了,我可以创建Twitter的对象,不会有问题。然而,在Android的工作室,任何引用该库显示无法解析符号,并显示为红色。什么我需要做的就是Android的工作室识别库?

The project compiles fine, and I can create twitter objects without a problem. However, in Android studio, anything referencing that library shows "cannot resolve symbol" and displays in red. What do I need to do to get Android Studio to recognize the library?

我已经尝试重建项目,./gradlew干净,和关闭并重新打开我的项目。

I have already tried rebuilding the project, ./gradlew clean, and closing and re-opening my project.

推荐答案

不知道这是否会工作或没有,但我唯一的想法至今:内右键单击文件树中的jar文件,并选择添加为库.. 。

No idea if this will work or not but my only thought so far: right click the jar file in file tree within AS and select "Add as library..."

编辑:你可以做文件 - >无效缓存...,然后选择无效,并重新启动选项来解决这个问题

编辑2:此修复程序应适用于所有类似事件,而不是一个twitter4j特定分辨率

这篇关于Android的工作室表示,"不能解析符号"但项目编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆