Bradsta
Bradsta

Reputation: 157

The module cannot be Android Library?

I'm using IntelliJ IDEA for Android Development, and when I try to edit the run configuration for the Android emulator, it says there is an error and it looks like this.

The emulator still runs but it doesn't launch the activity automatically and I'm just wondering what's causing this error and what are possible solutions. Thanks.

Upvotes: 6

Views: 5997

Answers (6)

Zon
Zon

Reputation: 19880

For an InstantApp - check that you run app, and not one of your features solely. Choose app on Android Studio bar to Run.

Upvotes: 2

Silex
Silex

Reputation: 2713

Also if you added a new module/library don't forget to change back to the right project before you press Run.

enter image description here

Upvotes: 1

user2661518
user2661518

Reputation: 2745

You are getting error because you are trying to run module library as an application.

If you want to run as application you need to add below in SpyMaze module build.gradle:

apply plugin: 'com.android.application'

If you are using SpyMaze module as a library keep

apply plugin: 'com.android.library'

And in edit configurations select main app. So you should see Run 'app' and not Run 'SpyMaze'

Upvotes: 1

Benjamin Piette
Benjamin Piette

Reputation: 3783

That happened to me too after following the Android Studio recommendations to switch "android" to "com.android.library in build.gradle.

So for the app module of my project, I just reverted this:

apply plugin: 'com.android.library'

Into this:

apply plugin: 'com.android.application'

Upvotes: 3

Neeraj Manchanda
Neeraj Manchanda

Reputation: 21

GO to "Project structure" icon (it is enlisting where your new,save project icons are showing) then click Module and select Android option and Uncheck Library Module or

PROJECT STRUCTURE->MODULE->ANDROID->UNCHECK LIBRARY

Upvotes: 2

Manjunath
Manjunath

Reputation: 2063

Seems like "SpyMaze" is an Android library project, so you can't run a library project, check this out

Upvotes: 1

Related Questions