将eclipse项目导入Android studio - 错误“此项目指的是Eclipse工作区...”

时间:2023-01-17 18:34:44

I tried to import an existing project eclipse to Android Studio, but I got a dialog message in import that I can't solve : "this project refers to Eclipse workspace relative path in its project metadata. To help import the project, please point to an Eclipse workspace directory."

我尝试将现有项目eclipse导入Android Studio,但是我在导入时得到了一条无法解决的对话框消息:“此项目在其项目元数据中引用Eclipse工作空间相对路径。为了帮助导入项目,请指向Eclipse工作区目录。“

please check screenshots

请查看截图

将eclipse项目导入Android studio  - 错误“此项目指的是Eclipse工作区...” 将eclipse项目导入Android studio  - 错误“此项目指的是Eclipse工作区...”

How I can solve it?

我怎么解决呢?

Thanks so much in advance

非常感谢提前

7 个解决方案

#1


9  

Simply delete all the folders and files from your project except manifest res,src and then import it in Android studio using Import from eclipse

只需删除项目中除manifest res,src之外的所有文件夹和文件,然后使用Import from eclipse在Android studio中导入它

#2


4  

I have same error. Let me explain all steps. You have Eclipse project and you want to import in Android Studio. So when you try to import it it will ask you to generate project at different location as shown below.

我有同样的错误。让我解释一下所有步骤。您有Eclipse项目,并且您想要在Android Studio中导入。因此,当您尝试导入它时,它会要求您在不同位置生成项目,如下所示。

将eclipse项目导入Android studio  - 错误“此项目指的是Eclipse工作区...”

when you click on next it will show you this screen.

当你点击下一步它会显示这个屏幕。

将eclipse项目导入Android studio  - 错误“此项目指的是Eclipse工作区...”

after proceeding you will get this screen.

继续操作后,您将看到此屏幕。

将eclipse项目导入Android studio  - 错误“此项目指的是Eclipse工作区...”

now the question is why it ask for Eclipse workspace path?

现在的问题是它为什么要求Eclipse工作空间路径?

Answer: There is hidden .classpath file in your Eclipse project. the .classpath file contains information that the JDT feature needs in order to properly compile the project: the project's source folders (that is, what to compile); the output folders (where to compile to); and classpath entries (such as other projects in the workspace, arbitrary JAR files on the file system, and so forth).

答:Eclipse项目中有隐藏的.classpath文件。 .classpath文件包含JDT功能为了正确编译项目所需的信息:项目的源文件夹(即编译的内容);输出文件夹(编译到的地方);和classpath条目(例如工作区中的其他项目,文件系统上的任意JAR文件等)。

First you have to select original Eclipse project path in Eclipse workspace path then you need to edit all file paths which is shown list. File names which are mentioned on left are already existed in original Eclipse project you have to set path so Android Studio will able to import project.

首先,您必须在Eclipse工作空间路径中选择原始Eclipse项目路径,然后您需要编辑显示列表的所有文件路径。左边提到的文件名已经存在于原始Eclipse项目中,你必须设置路径,以便Android Studio能够导入项目。

I have solved by this approach. Please let me know if you get any other error.

我用这种方法解决了。如果您收到任何其他错误,请告诉我。

#3


0  

There is another way.You can create new project in android studio and add all the files like java files in java folder and replace res files.If there is any library ,import those library as well.Now you are ready to work in android studio.

还有另外一种方法。你可以在android studio中创建新项目,并在java文件夹中添加java文件等所有文件并替换res文件。如果有任何库,也可以导入这些库。现在你准备在android studio中工作了。

I have tried this when the same error occurs to me.

当我遇到同样的错误时,我试过这个。

#4


0  

For others who have the same problem,

对于有同样问题的其他人,

Just remove .classpath file and then import the project again.

只需删除.classpath文件,然后再次导入项目。

Hope this helps.

希望这可以帮助。

#5


-1  

First of all please make sure that you have done all steps in proper manner as provided here, the migration guide for projects in Eclipse/ADT

首先,请确保您已按照此处提供的正确方式完成所有步骤,这是Eclipse / ADT中项目的迁移指南

As you can see from migration guide the Migration Prerequisites

从迁移指南可以看出迁移先决条件

carefully see In Eclipse ADT section there they have already told this.

仔细看看在Eclipse ADT部分他们已经告诉过了。

It may be useful to record your workspace directory, path variables, and any actual path maps that could be used to specify any unresolved relative paths, path variables, and linked resource references. Android Studio allows you to manually specify any unresolved paths during the import process

记录工作空间目录,路径变量以及可用于指定任何未解析的相对路径,路径变量和链接资源引用的任何实际路径映射可能很有用。 Android Studio允许您在导入过程中手动指定任何未解析的路径

This answer have some best explaination of steps and the same question have other answers with pretty good picture representation.

这个答案有一些最好的解释步骤,同样的问题有其他答案与相当好的图片表示。

since i have seen this same problem you have in this specific answer the guy mentioned same problem and he tried again and successfully imported project. So you can Configure your build as @AR.3 mentioned in his answer. But i still want you to check that you have followed all steps perfectly because in most cases it shouldn't happen. You can try to browse your specific prject from your eclipse workspace and see whats happen.

因为我在这个具体的答案中看到了同样的问题,他提到同样的问题,他再次尝试并成功导入项目。因此,您可以将您的构建配置为答案中提到的@ AR.3。但我仍然希望你检查一下你是否完全遵循了所有步骤,因为在大多数情况下它不应该发生。您可以尝试从Eclipse工作区浏览特定的项目,看看有什么发生。

#6


-1  

Try to export project from eclipse or add module from android studio. May be its takes your old dir paths. May be it helps you.

尝试从eclipse导出项目或从android studio添加模块。可能是它需要你的旧路径。可能对你有帮助。

#7


-1  

I dont know the exact cause and criteria that causes this but, it has to do with External Libraries Studio does not recoginze. I have found a very hacky solution that has served my purpose. It is not a total solution but it is the best i can offer to gracefully allow importing all sources

我不知道造成这种情况的确切原因和标准,但它与外部库工作室无法识别。我找到了一个非常hacky解决方案,达到了我的目的。它不是一个完整的解决方案,但它是我能提供的最好的,可以优雅地允许导入所有来源

  1. Always back up your Data
  2. 始终备份您的数据

  3. In the eclipse project Remove all external libraries via project properties-> java build path
  4. 在eclipse项目中通过项目属性 - > java build path删除所有外部库

  5. Close the project and import into studio
  6. 关闭项目并导入工作室

  7. Either Find compatible repo's with gradle or
  8. 使用gradle或者查找兼容的repo

  9. add your previous external libraries .jar,.aar in the libs folder
  10. 在libs文件夹中添加以前的外部库.jar,.aar

  11. point gradle to said folder and files compile fileTree(dir: 'libs', include: 'mylib-*.jar')
  12. 点gradle到所述文件夹和文件编译fileTree(dir:'libs',包括:'mylib - * .jar')

Like i said its a hacky work around but does the trick.

就像我说它是一个hacky工作,但做的伎俩。

#1


9  

Simply delete all the folders and files from your project except manifest res,src and then import it in Android studio using Import from eclipse

只需删除项目中除manifest res,src之外的所有文件夹和文件,然后使用Import from eclipse在Android studio中导入它

#2


4  

I have same error. Let me explain all steps. You have Eclipse project and you want to import in Android Studio. So when you try to import it it will ask you to generate project at different location as shown below.

我有同样的错误。让我解释一下所有步骤。您有Eclipse项目,并且您想要在Android Studio中导入。因此,当您尝试导入它时,它会要求您在不同位置生成项目,如下所示。

将eclipse项目导入Android studio  - 错误“此项目指的是Eclipse工作区...”

when you click on next it will show you this screen.

当你点击下一步它会显示这个屏幕。

将eclipse项目导入Android studio  - 错误“此项目指的是Eclipse工作区...”

after proceeding you will get this screen.

继续操作后,您将看到此屏幕。

将eclipse项目导入Android studio  - 错误“此项目指的是Eclipse工作区...”

now the question is why it ask for Eclipse workspace path?

现在的问题是它为什么要求Eclipse工作空间路径?

Answer: There is hidden .classpath file in your Eclipse project. the .classpath file contains information that the JDT feature needs in order to properly compile the project: the project's source folders (that is, what to compile); the output folders (where to compile to); and classpath entries (such as other projects in the workspace, arbitrary JAR files on the file system, and so forth).

答:Eclipse项目中有隐藏的.classpath文件。 .classpath文件包含JDT功能为了正确编译项目所需的信息:项目的源文件夹(即编译的内容);输出文件夹(编译到的地方);和classpath条目(例如工作区中的其他项目,文件系统上的任意JAR文件等)。

First you have to select original Eclipse project path in Eclipse workspace path then you need to edit all file paths which is shown list. File names which are mentioned on left are already existed in original Eclipse project you have to set path so Android Studio will able to import project.

首先,您必须在Eclipse工作空间路径中选择原始Eclipse项目路径,然后您需要编辑显示列表的所有文件路径。左边提到的文件名已经存在于原始Eclipse项目中,你必须设置路径,以便Android Studio能够导入项目。

I have solved by this approach. Please let me know if you get any other error.

我用这种方法解决了。如果您收到任何其他错误,请告诉我。

#3


0  

There is another way.You can create new project in android studio and add all the files like java files in java folder and replace res files.If there is any library ,import those library as well.Now you are ready to work in android studio.

还有另外一种方法。你可以在android studio中创建新项目,并在java文件夹中添加java文件等所有文件并替换res文件。如果有任何库,也可以导入这些库。现在你准备在android studio中工作了。

I have tried this when the same error occurs to me.

当我遇到同样的错误时,我试过这个。

#4


0  

For others who have the same problem,

对于有同样问题的其他人,

Just remove .classpath file and then import the project again.

只需删除.classpath文件,然后再次导入项目。

Hope this helps.

希望这可以帮助。

#5


-1  

First of all please make sure that you have done all steps in proper manner as provided here, the migration guide for projects in Eclipse/ADT

首先,请确保您已按照此处提供的正确方式完成所有步骤,这是Eclipse / ADT中项目的迁移指南

As you can see from migration guide the Migration Prerequisites

从迁移指南可以看出迁移先决条件

carefully see In Eclipse ADT section there they have already told this.

仔细看看在Eclipse ADT部分他们已经告诉过了。

It may be useful to record your workspace directory, path variables, and any actual path maps that could be used to specify any unresolved relative paths, path variables, and linked resource references. Android Studio allows you to manually specify any unresolved paths during the import process

记录工作空间目录,路径变量以及可用于指定任何未解析的相对路径,路径变量和链接资源引用的任何实际路径映射可能很有用。 Android Studio允许您在导入过程中手动指定任何未解析的路径

This answer have some best explaination of steps and the same question have other answers with pretty good picture representation.

这个答案有一些最好的解释步骤,同样的问题有其他答案与相当好的图片表示。

since i have seen this same problem you have in this specific answer the guy mentioned same problem and he tried again and successfully imported project. So you can Configure your build as @AR.3 mentioned in his answer. But i still want you to check that you have followed all steps perfectly because in most cases it shouldn't happen. You can try to browse your specific prject from your eclipse workspace and see whats happen.

因为我在这个具体的答案中看到了同样的问题,他提到同样的问题,他再次尝试并成功导入项目。因此,您可以将您的构建配置为答案中提到的@ AR.3。但我仍然希望你检查一下你是否完全遵循了所有步骤,因为在大多数情况下它不应该发生。您可以尝试从Eclipse工作区浏览特定的项目,看看有什么发生。

#6


-1  

Try to export project from eclipse or add module from android studio. May be its takes your old dir paths. May be it helps you.

尝试从eclipse导出项目或从android studio添加模块。可能是它需要你的旧路径。可能对你有帮助。

#7


-1  

I dont know the exact cause and criteria that causes this but, it has to do with External Libraries Studio does not recoginze. I have found a very hacky solution that has served my purpose. It is not a total solution but it is the best i can offer to gracefully allow importing all sources

我不知道造成这种情况的确切原因和标准,但它与外部库工作室无法识别。我找到了一个非常hacky解决方案,达到了我的目的。它不是一个完整的解决方案,但它是我能提供的最好的,可以优雅地允许导入所有来源

  1. Always back up your Data
  2. 始终备份您的数据

  3. In the eclipse project Remove all external libraries via project properties-> java build path
  4. 在eclipse项目中通过项目属性 - > java build path删除所有外部库

  5. Close the project and import into studio
  6. 关闭项目并导入工作室

  7. Either Find compatible repo's with gradle or
  8. 使用gradle或者查找兼容的repo

  9. add your previous external libraries .jar,.aar in the libs folder
  10. 在libs文件夹中添加以前的外部库.jar,.aar

  11. point gradle to said folder and files compile fileTree(dir: 'libs', include: 'mylib-*.jar')
  12. 点gradle到所述文件夹和文件编译fileTree(dir:'libs',包括:'mylib - * .jar')

Like i said its a hacky work around but does the trick.

就像我说它是一个hacky工作,但做的伎俩。