将项目导入 Android Studio 关于 ActionBarSherlock 的问题 [英] Problems importing project into Android Studio regarding ActionBarSherlock

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

问题描述

是否还有其他人在使用 ActionBarSherlock 导入项目时遇到问题?我总共有 100 个错误和 17 个警告.这在 Eclipse 中工作得很好.我按照步骤创建了一个 Gradle 构建文件.在我尝试构建项目之前没有导入错误.

Is anyone else having problems importing a project with ActionBarSherlock? I have a total of 100 errors and 17 warnings. This worked perfectly in Eclipse. I followed the steps to create a Gradle build file. There were no import errors until I tried to build the Project.

我也尝试重新下载新鲜的 ABS 并将其替换到我的项目中.

I also tried re-downloading ABS fresh and replace into my project.

ABS 和 IntelliJ 是否存在已知问题?(当然现在基于 Android Studio)

Were there known issues with ABS and IntelliJ? (which of course Android Studio is now based)

以下是我看到的一些错误:

Here are a few errors I'm seeing:

        java: ...
        Workspace/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockFragment.java:4: cannot find symbol
        symbol  : class Fragment
        location: package android.support.v4.app

        java: ...  Workspace/ActionBarSherlock/src/com/actionbarsherlock/app/SherlockListFragment.java:4: cannot find symbol
        symbol  : class ListFragment
        location: package android.support.v4.app

        java: ...
        Workspace/ActionBarSherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java:33:
        package android.support.v4.widget does not exist

非常感谢任何帮助

使用标准 IntelliJ IDEA 似乎没有问题.许多在线指南用于使用 ABS 进行设置.同样正如 Jake 提到的,他实际上一直在用 IntelliJ 开发这个东西

Seems there are no issues using Standard IntelliJ IDEA. Many guides online for setting it up with ABS. Also as Jake mentioned, he's actually been developing the thing in IntelliJ

这是一个示例指南:http://android-wtf.com/2012/09/how-to-configure-actionbarsherlock-with-intellij-idea/

但是,我仍然不确定为什么它在 Android Studio 中不起作用

However, I'm still unsure why its not working in Android Studio

Edit2: 以下答案中的解决方案.简而言之:(我下载了 abs 最新版本,从我的项目中提取、删除了旧版本的 abs,然后 file > import module...code> 将 actionbarsherlock 目录导入到我现有的项目中.注意,在我的特殊情况下,我遇到了 junit 编译错误的问题,需要删除 \test\junit\ )

solution in answer below. In Short: (I downloaded abs latest version, extracted, deleted the old version of abs from my project, then file > import module... to import actionbarsherlock directory into my existing project. Nb, in my particular case I had an issue with junit compilation error and needed to delete \test\junit\ )

推荐答案

似乎有很多关于将模块导入 Android Studio 的一般问题,而不仅仅是 ActionBarSherlock,这个answer 也可能解决这些问题.(不过与junit相关的最后一步是abs特有的)

Seems there's a lot of general issues on importing modules to Android Studio, not just ActionBarSherlock, this answer might also address those. (However the last steps relating to junit are particular to abs)

下面的步骤让我可以毫无问题地运行 ActionBarSherlock.

The steps below allowed me to get ActionBarSherlock running with no issues.

1) 在此处下载最新的 ABS:http://actionbarsherlock.com/

1) Download latest ABS here: http://actionbarsherlock.com/

2) 提取 ABS 您应该在那里有一个名为actionbarsherlock"的目录.将其复制到您的 Android Studio 工作区.并重命名为 ActionBarSherlock(更改大小写) --> 我现在在 \*documents*\Android Workspace\ 下有我的 Android Studio 项目,而不是 \Eclipse Workspace\

2) Extract ABS you should have a directory in there called "actionbarsherlock". Copy that to your Android Studio workspace. and rename to ActionBarSherlock (changed casing) -- > I now have my Android Studio Projects under \*documents*\Android Workspace\ As opposed to \Eclipse Workspace\

所以你现在应该有类似的东西:

So you should now have something like :

\*documents*\Android Workspace\ActionBarSherlock\

可能与您的主要项目一起:

Along with your main project maybe:

\*documents*\Android Workspace\TestProject\

3) 打开 Android Studio 加载您的 TestProject 然后转到 File>导入模块...现在导航到 \*documents*\Android Workspace\ActionBarSherlock\ 下的 ActionBarSherlock单击确定,然后一路完成.它会询问您是否要为新模块设置依赖项(或至少我的),单击确定"

3) Open Android Studio load your TestProject then goto File> Import Module... Now navigate to ActionBarSherlock under \*documents*\Android Workspace\ActionBarSherlock\ Click Ok and next all the way to finish. It will ask if you want to set a dependancy to the new Module (or at least mine did) click OK

4) 此时编译时我在 \ActionBarSherlock\test\ 中遇到错误,抱怨 Junit.我只是从项目视图下的 ABS 模块中删除了 \Test\ 目录.右击\test\>删除....您还可以包含 junit jar 文件,但我认为没有必要

4) at this point when compiling I was getting errors in \ActionBarSherlock\test\ complaining about Junit. I simply deleted the \Test\ directory from my ABS Module under project view. Right click \test\ > Delete.... You could also include the junit jar file but I don't think its necessary

5)您现在应该可以无误地编译

5) you should now be able to compile without errors

希望对某人有所帮助.

但本质上,我需要重新下载一个全新的 ABS,清除我旧项目的 ABS(可能很旧),然后导入模块...

Essentially though, I needed to re-download a completely fresh ABS, expunge my old project's ABS (which was probably quite old) then Import Module...

这篇关于将项目导入 Android Studio 关于 ActionBarSherlock 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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