[英]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.我正在使用 IntelliJ IDEA 进行 Android 开发,当我尝试编辑 Android 模拟器的运行配置时,它说有一个错误,看起来像这样。
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.在遵循 Android Studio 建议将 build.gradle 中的“android”切换到“com.android.library”之后,我也遇到了这种情况。
So for the app module of my project, I just reverted this:所以对于我项目的 app 模块,我只是恢复了这个:
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转到“项目结构”图标(它列出了显示新的保存项目图标的位置)然后单击模块并选择 Android 选项并取消选中库模块或
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:如果你想作为应用程序运行,你需要在 SpyMaze 模块 build.gradle 中添加以下内容:
apply plugin: 'com.android.application'
If you are using SpyMaze module as a library keep如果您使用 SpyMaze 模块作为库,请保留
apply plugin: 'com.android.library'
And in edit configurations select main app.并在编辑配置中选择主应用程序。 So you should see Run 'app' and not Run 'SpyMaze'
所以你应该看到 Run 'app' 而不是 Run 'SpyMaze'
For an InstantApp
- check that you run app
, and not one of your features
solely.对于
InstantApp
- 检查您是否运行app
,而不仅仅是您的features
之一。 Choose app
on Android Studio bar to Run.在 Android Studio 栏上选择要运行的
app
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.