2
I have an APP with a separate package(Package) for PUSH notification, I would like to take this package and turn it into Library, so that in future apps only add to Library in my project.
How can I do that?
EDIT
IDE: Eclipse
2
I have an APP with a separate package(Package) for PUSH notification, I would like to take this package and turn it into Library, so that in future apps only add to Library in my project.
How can I do that?
EDIT
IDE: Eclipse
1
With Eclipse you can create a JAR file containing the classes and project information. Unlike files .jar
, AAR files, possibly created using Android Studio, can contain Android features and a manifest file, which allows you to package shared resources such as layouts and drawables, in addition to Java classes and methods.
To create a lib You will follow the same flow to create a new project, but a flag with the following message:
Mark this project as a lib.
See in the image:
Soon after just import into your main project as a library. For access, right-click the mouse in the project and go on proprieties > Android. See in the image below:
See also how create a library using Android Studio
Perfect! I’ve already started doing it here. Take away one more question I need to pass the value of a variable that is in the app to my Library. How can I do it in the best way?
@William did not understand. You want to send a value to the library, so that it returns you something?
@William if that is the case, for example you can create a method calculatRaio(String cicunferencia) that returns a double. Then you will import the library and call the method calculatRaio(Circ) passing the circumference as parameter. This is a traditional way of doing. ^^
OK I’ll make a method, I didn’t know that you could call a method of the app inside the Library. I have a string that in the app I need the library to have access.
1
I do this: (assuming you know how to use github
apply plugin: 'com.android.application'
for apply plugin: 'com.android.library'
Thank you Mr_anderson, would you tell me how I do it using Eclipse?
0
I recently had the same need. I read a post by João Gabriel and solved my problems. Follow link:
0
It’s pretty quiet to do that..
First you’ll need to open the build.gradle
of the module you want to behave like a library, and then change apply plugin: com.android.application
for apply plugin: com.android.library
Now it will create an . AAR instead of an . APK.
To add a statement is also quiet, I advise you to take a look here: https://developer.android.com/studio/projects/android-library.html
I am not experienced in Android yet, so for the sake of knowledge, I would like to know what the advantages of doing this procedure?
Thank you Max Fratane, would you tell me how I do it using Eclipse?
Browser other questions tagged android eclipse
You are not signed in. Login or sign up in order to post.
Android Studio, Eclipse or other? Try edit and better detail your question, so you can get better answers.
– viana
Sorry, I’m using Eclipse
– William