0

So I'm having some problems with importing an existing project, everytime I import it and try to run it, the app crashes. I already did my research and people say that it usually helps to create a new project and then paste the existing one over the new one. I tried doing that, I simply created a new android project, and then pasted and overwritten it with my existing project. But that gave me a whole lot of errors so I probably did something wrong.

Could someone tell me what people usually mean by saying to create a new project and then paste the existing one over? My existing project that I'm having trouble importing us using 3 library projects and a few external jars. Thank you for any kind of help!

Guy
  • 6,414
  • 19
  • 66
  • 136
  • what is the crash saying when you try to import an existing project? – Marko Niciforovic Jul 18 '13 at 13:04
  • @MarkoNiciforovic [this](http://stackoverflow.com/questions/17704468/imported-project-throws-java-lang-classnotfoundexception) is the question, I already asked about it, but I didn't get an answer that would help me so I decided to try creating a new project and importing it that way – Guy Jul 18 '13 at 13:06

2 Answers2

1

1st Alternative:

Create a new Project, but when you chose to create a new project, Choose --> Create Project from existing Code, and move on with the settings. You should be good.

2nd Alternative:

  1. Put all source files into one directory named after your project. i.e. "ProjectName" You can keep this directory in your workspace or it can be somewhere else.
  2. Start a new project in eclipse and name it using that same project name.

  3. Uncheck the "use default location" box and find the directory where your project is unless your project is already in the workspace - then you must not uncheck the "use default location" box

  4. Click 'next'.

Let me know, if it helped.

JNL
  • 4,683
  • 18
  • 29
  • I'm pretty sure this is what I was looking for, I'll let you know if it works :) Thank you! – Guy Jul 18 '13 at 13:14
  • Sadly, it doesn't work, it gives even more errors than if I try to simply import it. After doing this, a bunch of .java files and a few xml files are corrupted (red x) – Guy Jul 18 '13 at 13:22
  • Looks like, there is a difference in the project you are trying to create. The difference should be mostly in including the correct application or something. Did you try the 2nd Alternative? – JNL Jul 18 '13 at 13:24
  • Yes this is the result of the second alternative. I already tried first alternative a while ago and [this was the result](http://stackoverflow.com/questions/17704468/imported-project-throws-java-lang-classnotfoundexception) – Guy Jul 18 '13 at 13:31
  • Can you just put down the steps, that you are going through. It should work. I upgrade my projects in the similar fashion. Are you sure you are not missing anything? – JNL Jul 18 '13 at 13:41
  • I tried it like this: First I selected Create a project from existing code, then I choosed the location that my existing project is at and succesfully imported it. I then added the needed build paths (three jar files) and three library project. After there were no more errors I tried to compile it and it crashed. When I was using the second alternative I couldn't even get to the compile error becuase as soon as I selected all build paths and libraries, almost all .java files withing src folder turned red – Guy Jul 18 '13 at 13:56
  • no :/ still the same problem, when I run the app, it throws classnotfoundexception, can't find MainActivity. I still accepted your answer because you gave me exactly what I asked for, but it still didn't solve my [main problem](http://stackoverflow.com/questions/17704468/imported-project-throws-java-lang-classnotfoundexception) – Guy Jul 19 '13 at 14:19
  • Thanks, for classcast exception, can you try this; delete or comment This caused ClassNotFoundException for launcher activity. I was checking manifest for possible mistake. After I have deleted this row, app was working. (DO NOT forget to rebuild app)..... Let me know if it helped. – JNL Jul 19 '13 at 14:54
  • Also, check if the namespaces are proper in your Manifest. – JNL Jul 19 '13 at 14:57
  • Just tried deleting but it doesn't work, app still crashes. I did Project --> Clean and it didn't work. And yes, namespaces are correct, I checked multiple times. I'm running out of ideas what to try and I really need to get this working :/ – Guy Jul 19 '13 at 22:10
  • Do you have a github/dropbox account, from where I can try and access your project if you don't mind. – JNL Jul 19 '13 at 23:01
  • Yes, ofcourse, [this is the dropbox link](https://www.dropbox.com/s/wafpvi6wf31kyd4/Evanturist%20project.rar), it's in a rar file, project and all 3 library projects are in there, thanks a lot for your help! I appreciate it – Guy Jul 19 '13 at 23:16
  • Did you figure anything our or should I delete the dropbox link? – Guy Jul 20 '13 at 18:16
  • Hey, you can delete the link, I have saved the project. I am busy with some other work this weekend, will look into it by tomorrow or Monday. – JNL Jul 20 '13 at 19:06
  • Hey, I just solved the problem! The problem was in google play services library. I used the one that comes with the project instead of the one downloaded with SDK. I can't believe I did such a stupid thing and didn't notice it. Thanks a lot for your help anyway but you don't need to take a look into it anymore :) Have a good one man! – Guy Jul 21 '13 at 00:59
0

Import for Existing Project into Workspace ?

Rollyng
  • 1,387
  • 2
  • 12
  • 18
  • Already tried that, as I already said, check [this](http://stackoverflow.com/questions/17704468/imported-project-throws-java-lang-classnotfoundexception) question – Guy Jul 18 '13 at 13:07