1

I'd like to build my android application using stub (as android.jar) and at run time use library which is located in device shell.

In build.gradle i wrote:

dependencies {
  provided files('mylib.jar')
}

but i still see the library in apk in instant-run.zip (mylib-classes.dex)

kunkers
  • 69
  • 5
  • What have you tried so far? That's the first link I've come across after typing "android gradle add jar dependency": http://stackoverflow.com/questions/20700053/how-to-add-local-jar-file-dependency-to-build-gradle-file – gonczor Apr 19 '17 at 09:22
  • I want to link to my library in android device as sdk is linked. In sdk you use stub in some cases, the full implementation exists in device. I want tu achive something similar – kunkers Apr 19 '17 at 09:34

3 Answers3

0

Place the jar in app/libs, and in app/build.gradle add in the dependencies section:

compile fileTree(dir: 'libs', include: ['file_name.jar'])

Hope this helps.

Ria Sen
  • 94
  • 13
  • Thank you for reply. I did it. But still I can see those library in instan-run.zip – kunkers Apr 19 '17 at 09:26
  • So what is the issue in seeing those ? If you satisfied with the answer then give an upvote. – Ria Sen Apr 19 '17 at 09:33
  • I want to link to full implementation of my library which is in my device. You dont see any part of android.jar (which is located in /system/framwork/android.jar) but you link to stub while building app in Android Studio for example – kunkers Apr 19 '17 at 09:38
0

Place the jar in app/libs, and in app/build.gradle add in the dependencies section:

compile fileTree(dir: 'libs', include: ['file_name.jar']) Hope this helps.

joshua787
  • 11
  • 6
0

Copy file mylib.jar to libs folder.

In build.gradle

 dependencies {
    compile files('libs/markdownview-1.2.jar')
 }
Hoang Duc Tuan
  • 415
  • 1
  • 4
  • 15