Problems importing project into Android Studio regarding ActionBarSherlock

前端 未结 4 1533
迷失自我
迷失自我 2020-11-29 01:24

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

相关标签:
4条回答
  • 2020-11-29 02:02

    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)

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

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

    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) 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) 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) you should now be able to compile without errors

    Hopefully that helps someone.

    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...

    0 讨论(0)
  • 2020-11-29 02:09

    i also faced the same issue. i even follow the steps similar to importing ABS Library. But i was still getting the same error. Finally i solved this issue. Solution: After following the steps similar for importing ABS Library,

    1. Re-compile your project (Right click on your project and click on 'Compile Module "YourApp" ')
    2. Re-compile the Library Project (Right click on Library project and click on 'Compile Module "library" ')

    That's it..

    0 讨论(0)
  • 2020-11-29 02:19

    I encountered similar issue, but due to a separate problem, I can't download the latest ActionBarShelock to fix the problem as wired00 described.

    If you need to stick with your existing ABS version, see if this works for you:

    1. Click File->Project Structure.
    2. You should see 'ActionBarSherlock' in the module list, click it.
    3. Click the 'Dependencies' tab, very likely you do not have android support library v4 in there.
    4. Click the '+' button at the bottom, and add android-support-v4 as a dependency. If you imported the project from Eclipse, Android Studio may have already imported the support JAR file as a library and you can use it directly. Otherwise, you may need to use the 'jars or directories' option and select the support jar file from a directory.
    5. If your main module or other modules are also using the support library, you may need to change the setting 'Compile' to 'Provided' if you get 'DEX Already Added' errors.
    6. You should be able to compile your ABS mobule now. If you get 'hamcrest' or 'junit' compilation errors, you may delete the 'test' folder in your ABS project as wired00 mentioned.
    0 讨论(0)
  • 2020-11-29 02:23

    This works for me..

    first, followed an answer provided by wired00

    and I made some changes from here.

    I made a build.gradle file in ActionBarSherlock library project by Generate Gradle build files from Eclipse.

    edit build.gradle(for ActioBarSherlock library project) , Add a line in dependencies {} compile files('libs/android-support-v4.jar')

    edit build.gradle(for my project), delete compile files('libs/android-support-v4.jar') and add compile project(':abs') abs should be ActionBarSherlock library project name.

    edit settings.gradle, add ,':abs'

    delete android-support-v4.jar files except the one in the ActionBarSherlock library project

    0 讨论(0)
提交回复
热议问题