I want to convert an android project into a library project. Can this be done?
I am trying to use this project in another project.
Creating The Android Library Open Android Studio and create a new Project. Name your application as ToasterExample and your project name as Toaster. The ToasterExample will be our sample application to show an example use of our application. Click on Finish and your project will be ready.
Select your project then go to Refactor -> Copy... . Android Studio will ask you the new name and where you want to copy the project. Provide the same. After the copying is done, open your new project in Android Studio.
Launch Android Studio, and click File > New > Import Project. Locate your project directory, click the build. gradle file you created above to select it, and then click OK to import your project.
Update for Android Studio option
Convert an app module to a library module
If you have an existing app module with all the code you want to reuse, you can turn it into a library module as follows:
Open the build.gradle file for the existing app module. At the top, you should see the following:
apply plugin: 'com.android.application'
Change the plugin assignment as shown here:
apply plugin: 'com.android.library'
Click Sync Project with Gradle Files
.
That's it. The entire structure of the module remains the same, but it now operates as an Android library and the build will now create an AAR file instead of an APK
Read more about how to Create an Android Library and how to Convert existing project to library project in Android Studio
Below steps are for Eclipse
Steps are
Right click on project -> property -> Android -> check 'Is library' check box -> OK
That's it.
S.It's possible. For eg: if you take Actionbar sherlock.
https://github.com/JakeWharton/ActionBarSherlock/tree/master/library, it's a library
that has been created . You can import that in properties->Android->library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With