简体   繁体   English

导入后,Android Studio无法看到模块

[英]Android Studio can't see module after import

Android Studio “beta” 0.8.6 on 64 bit Ubuntu 14.04 LTS. 64位Ubuntu 14.04 LTS上的Android Studio“测试版” 0.8.6。 Problem: When importing source code from various sources either gradle based or eclipse based in to Android Studio the source code is missing from the project view. 问题:从基于gradle或eclipse的各种源导入源代码到Android Studio时,项目视图中缺少源代码。 Screen shot post import “project” in Android Studio. 屏幕快照发布后在Android Studio中导入“项目”。 ![enter image description here][1] ![在此处输入图片描述] [1]

Screen shot of files within the project using Nautilus. 使用Nautilus的项目中文件的屏幕快照。

Note Nautilus clearly shows the source code, Gradle, IDE files. 注意Nautilus清楚地显示了源代码,Gradle和IDE文件。 Android Studio shows the Gradle files only. Android Studio仅显示Gradle文件。

The event log event log: 事件日志事件日志:

Error running app: Module is not found 运行应用程序时出错:找不到模块

So I tried to put the source code into the project using: 因此,我尝试使用以下方法将源代码放入项目中:

Android Studio main menu → File → New Module AND Android Studio main menu → File → Import Module Android Studio主菜单→文件→新建模块AND Android Studio主菜单→文件→导入模块

Tried most of the possible combinations in New Module and Import Module. 在“新模块”和“导入模块”中尝试了大多数可能的组合。 All the combinations Gave: 所有组合均给出:

“This Location is already imported” within the Module Wizard. 模块向导中的“此位置已被导入”。

So how do I get the source code in to the project? 那么,如何将源代码导入项目?

These problems with Gradle are beyond annoying and approaching the the R Object disaster in eclipse. Gradle的这些问题已超出烦人的范围,使R Object灾难日食化。 Where none of the build sequences repeat with any reasonable consistency. 如果没有任何构建序列以任何合理的一致性重复进行。

Thank you in advance for your help, ultra disgusted Mark. 马克非常反感,在此先感谢您的帮助。 Sorry about lack of images. 很抱歉缺少图片。

Got it to WORK! 得到它的工作! Used the command line, terminal described at: http://developer.android.com/sdk/installing/studio-build.html Section of that page titled “Build the project from the command line” has instruction for all three operating systems. 使用命令行,终端在以下位置描述: http : //developer.android.com/sdk/installing/studio-build.html该页面的标题为“从命令行构建项目”的部分提供了所有三个操作系统的说明。 C louse Android Studio, for some reason having it open interfers with the gradlew on my system anyway. 请关闭Android Studio,出于某种原因,无论如何都要打开它干扰我系统上的gradlew。 On Ubuntu Linux. 在Ubuntu Linux上。 In GNOME Terminal. 在GNOME终端中。 Navigate to the folder containing the project. 导航到包含项目的文件夹。 Enter: chmod +x gradlew gradlew is the gradle wrapper. 输入:chmod + x gradlew gradlew是gradle包装器。 If your project is missing the gradlew file use the Wizard in Android Studio to make a separate project and copy the gradlew file to the folder where you are working. 如果您的项目缺少gradlew文件,请使用Android Studio中的向导创建一个单独的项目,并将gradlew文件复制到您正在工作的文件夹中。 The chmod +x makes the gradlew executable, need to be run once for each project. chmod + x使gradlew可执行,每个项目需要运行一次。 The project Should build, if you get errors do your best to look them up and fix them. 该项目应该构建,如果遇到错误,请尽力查找并修复它们。

Once I did the above and imported in to Android Studio the project worked perfect in with in the IDE and even ran in an AVD. 完成上述操作并将其导入Android Studio后,该项目就可以在IDE中完美运行,甚至可以在AVD中运行。

Beyond me how the command line works fine and the IDE cause nothing but grief and extreme aggravation (~ two days in my case). 除了我,命令行是如何正常工作的,IDE只会导致悲伤和极端恶化(在我看来是两天)。

SO if Android Studio will not import or open a project try the command line. 因此,如果Android Studio无法导入或打开项目,请尝试使用命令行。 Give that you have the proper build.gradle files (between the android plug in changing the stuff that goes in build.gradle changes as well so it a Screaming Nightmare to keep up with it). 给出您具有正确的build.gradle文件(在android插件之间更改build.gradle中包含的内容也进行更改,因此跟上它是一个尖叫的噩梦)。

I hope that helped somebody out. 我希望这可以帮助到别人。 Mark 标记

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

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