Reputation: 419
I'm having a lot of trouble trying to create an Android Studio project with just a library module in it. If I go to File -> New -> New Project, it assumes that I'm making an app, even if I tell it not to create an empty activity. If I then make a library module, I'll have a useless app
module in the project as well.
Is there any way to remove that module? I've tried deleting the directory (which seems to confuse Android Studio) and I've tried deleting it through the Module Settings menu in Android Studio (which causes it to be immediately recreated). There must be a way to do this, right?
Upvotes: 2
Views: 1857
Reputation: 329
You don't delete the App module, you convert it to a library per the instructions here: https://developer.android.com/studio/projects/android-library#Convert.
In summary:
If you now build, you'll get an AAR instead of an APK.
Upvotes: 1
Reputation: 419
For anyone who is having this same problem, it appears that you truly cannot delete the app module from an Android Studio project. All projects must have an app module, even if the main purpose is to create a library. I ended up making a small example app showing how to use the library, which appears to be the convention.
Upvotes: 3
Reputation: 192023
You want to make a module, which needs to be part of a project.
Feel free to delete the app
module, or actually show example usage of your library, which is what most libraries provide
Create a library module
To create a new library module in your project, proceed as follows:
Click File > New > New Module
In the Create New Module window that appears, click Android Library, then click Next.
Upvotes: 0