简体   繁体   English

Android工作室。 导入后未指定模块

[英]Android studio. Module not specified after import

I use android studio. 我用android studio。 I import example project from official site 我从官方网站导入示例项目

http://developer.android.com/training/contacts-provider/retrieve-names.html http://developer.android.com/training/contacts-provider/retrieve-names.html

When I try Run it I get Edit configuration window with Error: Module not specified . 当我尝试运行它时,我得到Edit configuration窗口,其中包含Error: Module not specified

I read this answer 我读了这个答案

https://stackoverflow.com/a/16625227/1864033 https://stackoverflow.com/a/16625227/1864033

and mark (in Project structure -> modules ) my res/ folder as resources folder and sources folders as sources . 并标记(在Project structure -> modules )我的res/文件夹作为resources文件夹和源文件夹作为sources

Problem still alive. 问题仍然存在。

Also Project structure -> modules say that .gradle and build is excluded folders. 另外Project structure -> modules.gradlebuild是排除的文件夹。

What means "Module not specify" in android studio case? android studio案例中“模块未指定”是什么意思?

Probably you have to update your Android Studio Version and try again. 您可能需要更新Android Studio版本并重试。 I imported that sample without any issues and it's running fine on the Emulator. 我没有任何问题导入了该示例,它在模拟器上运行正常。

This is my import report from Android Studio: 这是Android Studio的导入报告:

ECLIPSE ANDROID PROJECT IMPORT SUMMARY ECLIPSE ANDROID项目进口摘要

Replaced Jars with Dependencies: -------------------------------- The importer recognized the following .jar files as third party libraries and replaced them with Gradle dependencies instead. 用依赖项替换了Jars:--------------------------------导入程序将以下.jar文件识别为第三方库和取而代之的是Gradle依赖项。 This has the advantage that more explicit version information is known, and the libraries can be updated automatically. 这具有以下优点:已知更明确的版本信息,并且库可以自动更新。 However, it is possible that the .jar file in your project was of an older version than the dependency we picked, which could render the project not compileable. 但是,项目中的.jar文件可能比我们选择的依赖项版本旧,这可能导致项目无法编译。 You can disable the jar replacement in the import wizard and try again: 您可以在导入向导中禁用jar替换,然后重试:

android-support-v4.jar => com.android.support:support-v4:19.1.0 android-support-v4.jar => com.android.support:support-v4:19.1.0

Moved Files: ------------ Android Gradle projects use a different directory structure than ADT Eclipse projects. 移动文件:------------ Android Gradle项目使用与ADT Eclipse项目不同的目录结构。 Here's how the projects were restructured: 以下是项目重组的方式:

  • AndroidManifest.xml => app\\src\\main\\AndroidManifest.xml AndroidManifest.xml => app \\ src \\ main \\ AndroidManifest.xml
  • res\\ => app\\src\\main\\res\\ res \\ => app \\ src \\ main \\ res \\
  • src\\ => app\\src\\main\\java\\ src \\ => app \\ src \\ main \\ java \\

Next Steps: ----------- You can now build the project. 后续步骤:-----------您现在可以构建项目。 The Gradle project needs network connectivity to download dependencies. Gradle项目需要网络连接才能下载依赖项。

Bugs: ----- If for some reason your project does not build, and you determine that it is due to a bug or limitation of the Eclipse to Gradle importer, please file a bug at http://b.android.com with category Component-Tools. 错误:-----如果由于某种原因您的项目没有构建,并且您确定它是由于Eclipse到Gradle导入程序的错误或限制,请在http://b.android.com上提交错误与类别组件 - 工具。

(This import summary is for your information only, and can be deleted after import once you are satisfied with the results.) (此导入摘要仅供您参考,一旦您对结果感到满意,可以在导入后删除。)

This sample project was not created for Android studio but for an eclipse project. 此示例项目不是为Android工作室创建的,而是为eclipse项目创建的。 So try to import this project to eclipse, and then export it to a Gradle project.If successful, you should now be able to import to android studio without any issue. 因此,尝试将此项目导入eclipse,然后将其导出到Gradle项目。如果成功,您现在应该可以导入到android studio而不会出现任何问题。

我希望这可以帮到你点击“文件”,然后选择“新模块”,然后选择“导入Gradle项目”,找到模块的文件夹,完成。

For my case, it was an existing Android studio project. 就我而言,它是一个现有的Android工作室项目。 What I did was to first close the project, and to open it, I clicked on "Open An Existing Android Studio Project" and it opened the project properly 我做的是首先关闭项目,打开它,我点击“打开一个现有的Android Studio项目”,它正确地打开了项目

对于我的情况,我通过将项目与gradle文件同步来解决了同样的问题。

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

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