17

I am currently migrating all my projects from Eclipse to IntelliJ Idea.

When I was using Eclipse, the package was only included in ActionBarSherlock library and when the library was included in my project, everything was automatically added.

With IntelliJ, once the android-support-v4.jar is added to ABS, that does not seems enough, as all my imports are broken.

Screenshot of ActionBarSherlock (LibABS) imports:

enter image description here

Everything seems fine, all the SherlockActivity are fine, but all the stuff related to support is not recognized in my application:

java: /home/user/workspace/.... cannot access android.support.v4.app.FragmentActivity class file for android.support.v4.app.FragmentActivity not found 

So, I have to copy manually the jar into a libs folder and include it to my project once again.

Screenshot of my project imports:

enter image description here

The imports are recognized, nut I now get this error:

Android Dex: [BeTrains-for-Android] UNEXPECTED TOP-LEVEL EXCEPTION: Android Dex: [BeTrains-for-Android] java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ShareCompat$ShareCompatImplJB; 

Thank a lot for any help.

10
  • Try to remove remove android-support-v4.jar from dependencies now. It's already included via LibABS dependencies. Commented Dec 31, 2012 at 8:33
  • As explained, I get a : java: /home/user/workspace/.... cannot access android.support.v4.app.FragmentActivity class file for android.support.v4.app.FragmentActivity not found Commented Dec 31, 2012 at 8:33
  • in the first case you don't have LibABS dependencies as in the second case. Commented Dec 31, 2012 at 8:34
  • First case in a screenshot of LibABS dependencies, second case is a screenshot of my application dependencies Commented Dec 31, 2012 at 8:36
  • 4
    Try to change android-support-v4.jar dependency to scope provided in your project. Commented Dec 31, 2012 at 8:39

1 Answer 1

15

Try to play with dependencies scopes and export flags. Check this page for the description: dependency tab.

Sign up to request clarification or add additional context in comments.

4 Comments

Waouw, everything is fixed. The issue was that I was using SlidingMenu, so the trick was to include only Slidingmenu in My main project, the Slidingmenu included ABS that needed to be exported, and ABS icluded support jar that also needed to be exported.
As an FYI, this boils down to needing to set Export within any referenced project, such as ActionBarSherlock in which you want to leverage that projects references, in this case android-support-v4.jar.
I had the same problem while using Facebook and ActionBarSherlock as modules. I solved this by setting the Scope to Provided in both modules.
@mparaz I am not getting android.support.v4 in both module option...any idea why?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.