简体   繁体   中英

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.

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'

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

好像“SpyMaze”是一个Android库项目,所以你不能运行一个库项目, 看看这个

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'

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

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM