Friday, August 19, 2016

android studio generate jar and add jar to modul

first I need to generate a jar from library project in android-map-util demo

In fact, when you build, it already generate the jar, the location is at: "classes.jar"

C:\jh\android\template\android-maps-utils-master\library\build\intermediates\bundles\release


rename classes.jar to your want, for example, android_map_util.jar


-----------------------------------------------------------
second you need to import this jar to your own app.

This is how you import jar.



In the project right click
-> new -> module
-> import jar/AAR package
-> import select the jar file to import
-> click ok -> done

Follow the screenshots below:

1:
Step 1
2:

In the project right click
-> new -> module
-> import jar/AAR package
-> import select the jar file to import
-> click ok -> done

Follow the screenshots below:

1:
Step 1
2:
enter image description here
3:
enter image description here
You will see this:
enter image description here

---------------------------------------------------------------------------------


third, now you have jar, you need to make it available to your app.

1.click your app(module)
2.click file - project structure
3. click dependency tab
4. click + button
5. choose add module
6. choose android-map-util.jar( which is just imported.)

7. go to your build.gradle file, you should see, compile project(':android_map_util')



No comments: