Use support library in android projects and library (Android Studio)

前端 未结 4 340
别那么骄傲
别那么骄傲 2021-01-04 02:50

I\'m using the new Android Studio, I\'m looking for a way to use the support library from multiple projects. Basically I have a project that uses the ActionBarSherlock

相关标签:
4条回答
  • 2021-01-04 03:06

    I had a similar issue happen to me. Select actionbarsherlock in the project tab/bar/whatever (on the left, so you can see the project tree). hit F4 to open the module settings.
    Make sure that you are not using the same dependencies twice in actionbarsherlock and your project.
    Also make sure that you're using the version of the support library that's in the android-studio sdk (android-studio/sdk/extras/android).

    Finally, if you're like me, make sure you didn't accidentally make actionbarsherlock dependent on itself, thus loading the library twice THAT way! >.<

    Take a look at these images showing my module preferences: http://imgur.com/a/JupWp Actionbar Sherlock enter image description here

    Also, don't forget to make sure libs isn't hiding any of the same ones!

    0 讨论(0)
  • 2021-01-04 03:06

    Did this use to be an Eclipse project? If so try going into Eclipse, clean the project, exit, rebuild in IntelliJ. I believe this is a state-issue, not a configuration issue.

    0 讨论(0)
  • 2021-01-04 03:11

    I fixed this by going into File > Project Structure... and selecting Modules then click on the module's Dependencies tab. Then next to the library I changed the scope from Compile to Provided.

    This means the module can still use it, but it doesn't reach compile, since I assume you are already using that JAR in your main project.

    Hope this helps!

    0 讨论(0)
  • 2021-01-04 03:24

    Instead of importing android support library as jar, I changed the libraries (in my case facebook sdk) dependencies in build.gradle to:

    dependencies {
        compile 'com.android.support:support-v4:13.0.0'
     }
    
    0 讨论(0)
提交回复
热议问题