0

I know and completely aware of that I can create and integrate a library project in Android Studio with my main project.

My question is:

  1. Can I convert a fully functional Android application with lots of layouts, XMLs and view into Android Library Project?

  2. If the answer is yes (I've already tried, it seems feasible). But I am confused about the Android Manifest of the library project as it was a manifest of an application. I am getting error like

    Error:(1046) Attribute "orientation" has already been defined Error:Execution failed for task ':processDebugResources'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/root/Android/Sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1

  3. What changes should I make to successfully integrate this application as library with another application. I am sensing it should be the manifests, removing the drawables, something like this?

Or it is not possible? I have to recreate the library from scratch?

Edit

Following the suggested link give me the error

Error:Execution failed for task ':transformClassesAndResourcesWithSyncLibJarsForDebug'.
> error
Community
  • 1
  • 1
Abdullah
  • 935
  • 9
  • 18
  • "And I already tried" what steps did you follow? – Sufian Jun 21 '16 at 05:28
  • The common steps. I followed this link http://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio?rq=1 – Abdullah Jun 21 '16 at 05:54
  • That question is about how to add a library to your project, and NOT "how do I make my project a library?". – Sufian Jun 21 '16 at 06:54
  • 1
    Tell if this question does what you want - [Convert existing project to library project in Android Studio](http://stackoverflow.com/questions/17614250/convert-existing-project-to-library-project-in-android-studio). – Sufian Jun 21 '16 at 06:56
  • @Sufian Thanks. I already went through the links and get help on how I should change my build.gradle files. But I need to know what should I do with the UI related things, JNI files on the library project. – Abdullah Jun 22 '16 at 05:49
  • Studio should handle this itself. If you face problems after following the link, update your question with any error logs you see. :) – Sufian Jun 22 '16 at 05:59
  • **1.** Post your `build.gradle`. **2.** Do you have "Instant Run" enabled? – Sufian Jun 22 '16 at 11:17

2 Answers2

0

Accoriding to google doc During the build process, manifest merging combines the settings from the various AndroidManifest.xml files included in your app into a single, generated APK manifest file for app packaging and distribution. Manifest settings are merged based on the manifest priority, determined by the manifest's file location. The problem is because both of the libraries use this

<attr name="orientation">

you can change it to other name

Krutik
  • 732
  • 6
  • 19
0

Steps to export the android project as modules 1. create new android project 2. selct File ->new Module->select android library 2. name the module and select 4. go to gridle select build-> assemble relese click an wait 5. now you have your module to be exported follow this link http://dominoc925.blogspot.in/2015/09/how-to-create-and-use-android-archive.html.

Abhishek
  • 16
  • 2