简体   繁体   English

Mutilmodule应用。 仅第一个模块有效。 Android Studio

[英]Mutilmodule app. Only first module works. Android Studio

I have a project with 3 additional library project(modules) from projects I created previously. 我有一个项目,该项目带有我之前创建的项目中的3个其他库项目(模块)。

All codes works perfectly as a stand alone, however on importing all 3, only module 1 works. 所有代码都可以作为独立代码完美运行,但是在导入所有3个代码时,只有模块1可以工作。 The build and manifest merge are successful, no errors. 构建和清单合并成功,没有错误。 Code associated with module 1 works perfect however, when user interacts with any code from 2 and 3 the application stops working and exits. 与模块1相关联的代码可以完美运行,但是,当用户与2和3中的任何代码进行交互时,应用程序将停止工作并退出。

Module 1, 2 and 3 has no code interaction. 模块1、2和3没有代码交互。 Each module when configured as an application can be used entirely on its own. 每个模块在配置为应用程序时都可以单独使用。 The program is written so that on pressing different buttons module1,2,3 is used pending which button is pressed. 编写程序是为了在按下不同的按钮时使用模块1、2、3,直到按下哪个按钮。

I have also tested module 2 with aa test app just to see if it works as module and it does. 我还使用一个测试应用程序对模块2进行了测试,以查看其是否可以正常工作。 Did the same with module 3 and the same result. 对模块3做同样的事情,结果也一样。 However on adding both module 2 and 3 together, whichever module I add second, gives the same error as above. 但是,将模块2和3一起添加时,无论我添加的是哪个模块,都会产生与上述相同的错误。

Is it that android studio can only accept one module in addition to the project module? 是不是Android Studio除了项目模块之外只能接受一个模块?

All research indicate that it should be able to take multiple modules but I'm request assistance from you guys, my seniors. 所有研究表明,它应该能够采用多个模块,但是我要求你们,我的前辈们提供帮助。

In module 1's build.gradle file, make sure that the other modules are specified as dependencies. 在模块1的build.gradle文件中,确保将其他模块指定为依赖项。 For example: 例如:

dependencies {
    ...
    compile project(':module2')
    compile project(':module3')
    ...
}

Also, in the project's settings.gradle file, make sure the other modules are included, as in: 同样,在项目的settings.gradle文件中,确保包括其他模块,如下所示:

include ':module1', ':module2', ':module3'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 android-studio调试有效,但不适用于此应用。 为什么? - android-studio debugging works, just not with this app. why? Android应用。 在模拟器中工作,但在android设备中不工作 - Android app. works in emulator but not working in android device 第一个Android应用。 我应该使用蜂窝的2.3.3版本吗? - First android app. Should I use the 2.3.3 version of the honeycomb? Android Studio 0.8.1无法再安装应用。 等待设备 - Android Studio 0.8.1 can no longer install app. waiting for device 第一款Android App。 edit_message无法解析或不是字段 - First Android App. edit_message cannot be resolved or is not a field Android应用。 ClassNotFoundException - Android App. ClassNotFoundException Android Studio条形码扫描仪应用程序。 通过意图扫描 - Android Studio Bar Code Scanner App. Scanning Via Intent 列表视图崩溃。 不工作的应用程序。 Android Studio 模拟器 - ListView crashes. Not working app. Android Studio Emulator 我的Android Studio应用仅适用于23或以上的API - My Android Studio app only works for API's 23 and above 我在“活动”中设置了一个开关语句来处理OnClick事件,但只有第一种情况有效。 为什么? - I set up a switch-statement to handle OnClick events in my Activity, but only the first case works. Why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM