Import eclipse project to Android studio - error “this project refers to Eclipse workspace…”

后端 未结 8 1057
梦如初夏
梦如初夏 2021-02-07 00:19

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 re

相关标签:
8条回答
  • 2021-02-07 01:06

    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.

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

    after proceeding you will get this screen.

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

    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).

    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.

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

    0 讨论(0)
  • 2021-02-07 01:06

    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

    1. Always back up your Data
    2. In the eclipse project Remove all external libraries via project properties-> java build path
    3. Close the project and import into studio
    4. Either Find compatible repo's with gradle or
    5. add your previous external libraries .jar,.aar in the libs folder
    6. point gradle to said folder and files compile fileTree(dir: 'libs', include: 'mylib-*.jar')

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

    0 讨论(0)
提交回复
热议问题