How to import external library in android studio?

后端 未结 3 1166
独厮守ぢ
独厮守ぢ 2021-02-10 04:05

I struggle to import library \'PageSlidingTapStrip\'(https://github.com/astuetz/PagerSlidingTabStrip).

I found this question(How to import eclipse library project from g

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-10 04:32

    I also use the PagerSlidingTabStrip Project in my app and everything works fine. I'm not sure if it's already possible to add a library project via the IDE (-> without any problems). Please try to add the library project by editing the gradle files like this:

    • first delete your module PagerSlidingTabStrip
    • then create a folder in your root project directory (-> NewOne) named 'libs'
    • copy the complete folder 'library' of the PagerSlidingTabStrip project on git into 'libs'
    • rename the folder 'library' that you just copied to e.g. "PagerSlidingTabStripLibrary" (just to avoid confusion) -> after the renaming you should have the path: "NewOne/libs/PagerSlidingTabStripLibrary"
    • now add this library in your settings.gradle with the following command:

      include ':libs:PagerSlidingTabStripLibrary'
      
    • go to your build.gradle file of your AppProject aps and add the following line to your 'dependencies':

      compile project(':libs:PagerSlidingTabStripLibrary')
      
    • at least you have to sync your gradle files: Tools -> Android -> Sync Project with Gradle Files

    Please try this. If you get errors please post the log file.

提交回复
热议问题