2

I've got a problem on library importation. I followed these step :

  1. File / New / Import Module.
  2. Then I go to Project structure, Dependencies and "+". But there is Nothing to show.

Is somebody can help me ?

Screen : https://i.stack.imgur.com/B72EM.jpg

Arnaud
  • 81
  • 1
  • 10

4 Answers4

1

In order to add library module in your project you should follow the following steps:

1) After adding library, open your project's build.gradle file and add implementation project(path: ':yourLibraryName').

2) Don't sync yet, now open your settings.gradle file and add your project with your library: include ':yourLibrayName', ':yourProject/ModuleName'. Now sync.

3) After sync you will be able to use your library in your project.

Umair
  • 6,366
  • 15
  • 42
  • 50
1

Go to main menu -> File -> New -> Import Module. Then select the source code. Give module a name. (Android studio 3.3)

Add following line to app build.gradle

implementation project(':module_name')

Also in the settings.gradle file should have following line

  include ':app'
  include ':module_name'

Import module

ramz_adf
  • 56
  • 8
0

try : go to SDK manager-> SDK tools : look for Support repository and download them this might work

xbadal
  • 1,284
  • 2
  • 11
  • 24
  • This is a specific library from exoplayer what I need to add. – Arnaud Feb 05 '19 at 11:43
  • Yes, I've download the repo, take HLS library, adding it via File / New / Import Module (and it worked). But nothing appear in project structure, or in depency tab. – Arnaud Feb 05 '19 at 11:47
  • have you downloaded repo externally and now you want to add in gradle? or what? – xbadal Feb 05 '19 at 11:51
  • At the start, I just want update my exoplayer project from 2.8.4 to 2.9. But, I get this error : ERROR: HlsSampleStreamWrapper.java:174-175: Lambda coming from jar file need their interfaces on the classpath to be compiled, unknown interfaces are java.lang.Runnable As I understant, I need to add HLS library from exoplayer repo. – Arnaud Feb 05 '19 at 11:53
  • okay Change your project view from Android to Project; your will find it at top of android studio. then there will be a repo named "external lib" – xbadal Feb 05 '19 at 11:55
  • add this in gradle compileOptions { targetCompatibility JavaVersion.VERSION_1_8 } – xbadal Feb 05 '19 at 12:12
  • add this in gradle compileOptions { targetCompatibility JavaVersion.VERSION_1_8 } – xbadal Feb 05 '19 at 12:37
  • Added targetCompatibility JavaVersion.VERSION_1_8 + JackOptions Enabled – Arnaud Feb 05 '19 at 12:38
0

You need to add import module in gradle also

Try this

implementation project(path: ':yourLibName')

than sync it will show dependencies.

Bunny
  • 1,044
  • 12
  • 23
  • Added implementation project(path: ':hls') but does not works : Project with path ':hls' could not be found in project ':app'. – Arnaud Feb 05 '19 at 12:26
  • gradle synced properly? – Bunny Feb 05 '19 at 12:31
  • no, it give me this error : Project with path ':hls' could not be found in project ':app'. – Arnaud Feb 05 '19 at 12:32
  • its mean your lib not added in your project ...just remove lib for now and add module again to follow this link https://stackoverflow.com/questions/51894689/how-to-edit-external-library-for-android-studio-3-1-2/51894832#51894832 – Bunny Feb 05 '19 at 12:34