0

I have made a main application. To this application I want to add a keyboard. So I made a keyboard in another project. The question is how I could let my keyboard be imported in the main application. I hope I was clear enough. And thanks for answering

Rts Ayat
  • 25
  • 5
  • can you elaborate your question pls ? – Magesh Pandian May 05 '17 at 16:44
  • Have you tried this [answer](http://stackoverflow.com/questions/16601299/how-to-create-a-library-project-in-android-studio-and-an-application-project-tha)? – Ali Ahsan May 05 '17 at 17:01
  • +Magesh Pandian I have made a keyboard for my app but in another application. I want the keyboard to be available for the first app.It's a custom keyboard. How do I do? – Rts Ayat May 05 '17 at 18:21

1 Answers1

1

Build your keyboard app as a library, and add it as a module in the Main Project.

Follow the steps below to import your keyboard project as a library;

  • Copy the content of your Keyboard project folder inside the Main Folder of the Parent project,make the following changes to the Keyboard project folder

a. Delete everything inside the folder leaving just the app directory.

b. Cut all the content of the app directory and drop it outside the app directory so that your keyboard project folder has something like dis

Structure of your keyboard library after deleting the unneeded files

c. Open the build.gradle and apply android plugin as a library apply plugin: 'com.android.library'

  • Open settings.gradle in the main project folder and include your library include ':app', ':keyboard'

  • Open your main app build.gradle and add it to the dependencies like this compile project(':keyboard')

I hope i didnt miss any steps, with this your keyboard is seen as a library in your Main App

Distjoy
  • 431
  • 3
  • 7
  • I'll try this and I'll reply to you. – Rts Ayat May 05 '17 at 18:22
  • For some kind of reasons, I'm unable to convert the keyboard to a library. I replaced in the build.gradle the apply plugin: 'com.android.library' but the file built is an apk? Could you help me providing a step to step tutorial? – Rts Ayat May 05 '17 at 18:41
  • Alright I will edit my answer with a step by step process,in a bit. – Distjoy May 05 '17 at 18:42
  • @RtsAyat You're welcome! ...kindly mark as answer and upvote. – Distjoy May 06 '17 at 07:27