Android的Studio项目无法解析ActionBarSherlock进口 [英] Android Studio project can't resolve ActionBarSherlock imports

查看:752
本文介绍了Android的Studio项目无法解析ActionBarSherlock进口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这对ActionBarSherlock在设定的依赖一个Android Studio项目的build.gradle

I have an Android Studio project which has a dependency on ActionBarSherlock set in build.gradle:

dependencies {
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile project(':Core')
    compile fileTree(dir: 'libs', include: '*.jar')
}

该项目成功生成在命令行中使用 gradle这个组装assembleDebug ,也构建并从IDE运行得很好,当我preSS <大骨节病> CTRL + <大骨节病> D 。当我查看了一些在IDE中福尔摩斯相关的源文件,不过,该文件是充满了红色的错误通知,从这一行:

The project builds successfully on the command line with gradle assemble assembleDebug and also builds and runs just fine from the IDE when I press ctrl+D. When I view some of the Sherlock-related source files in the IDE, though, the file is full of red error notifications, starting with this line:

import com.actionbarsherlock.app.SherlockPreferenceActivity;

这是弹出的工具提示说

无法解析符号福尔摩斯preferenceActivity

Cannot resolve symbol 'SherlockPreferenceActivity'

和没有一个上下文敏感的东西,如自动完成可用。

and none of the context-sensitive stuff such as auto-completion is available.

我曾经尝试过的文件>的Invalidate缓存/重启>废止和重新启动的菜单选项,这似乎并没有治好的问题。我怎样才能得到Android的工作室,正确解决此导入?

I had tried the File > Invalidate Caches/Restart > Invalidate and Restart menu option, which doesn't seem to have cured the problem. How can I get Android Studio to correctly resolve this import?

推荐答案

首先同步您的使用gradle这个项目,并检查它是否提供了一些错误,如果它工作得很好回去试试您的任何类别的进口来自actionbarsherlock库的东西。

First sync your project with gradle and check if it gives some error, if it worked fine go back and try importing something from actionbarsherlock library in any of your class.

如果上面的步骤没有帮助。检查一次Your_Project / your_module /建设/爆炸,捆/ ComActionbarsherlock ... / classes.jar存在与否。

If above step doesn't help. Check once Your_Project/your_module/build/exploded-bundles/ComActionbarsherlock.../classes.jar exists or not.

然后再为这样的:

从清洁项目建设&GT;清理项目,同步你的项目,比的gradle检查此作为参考。

Clean your project from Build > Clean Project, sync your project with gradle than check this for reference.

<一个href=\"http://stackoverflow.com/questions/21081598/import-google-play-services-library-in-android-studio/21086904#21086904\">Import谷歌Play服务库Android Studio中

或者按照以下步骤:


  • 退出Android的工作室

  • 从项目中删除所有.iml文件和文件夹.idea里面

  • 重新启动] Android的工作室,等到的gradle与
  • 完全同步的项目
  • Exit Android Studio
  • Delete all the .iml files and files inside .idea folder from your project
  • Relaunch Android Studio and wait till the project synced completely with gradle

这是错误Android Studio中0.4.2固定为Android工作室0.4.3版本。

This is bug in Android Studio 0.4.2 and fixed for Android Studio 0.4.3 release.

这篇关于Android的Studio项目无法解析ActionBarSherlock进口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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