-1

I have added some java functions from Project A into Project B. Then, when I try to run Project B, I received the error. When I compare the xml file from both projects, they have different packages.

So do I need to add the packages from Project A into Project B as well ? If yes, how do I do that ?

Please help, I am very new to this

Code for Project B is as below

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.tensorflow.demo"
>

Code for Project A is as below

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms.samples.vision.ocrreader"
android:installLocation="auto" >

These are the files that I added from Project A to Project B Files from Project A,

Added into Project B

the new error

sarah. isml
  • 35
  • 1
  • 6
  • Show your methods that you added. – Lekr0 Jan 27 '19 at 05:34
  • I simply copy java files from Project A into java files of Project B @Lekr0 – sarah. isml Jan 27 '19 at 05:36
  • Possible duplicate of [package R does not exist](https://stackoverflow.com/questions/12986301/package-r-does-not-exist) – Tedinoz Jan 27 '19 at 05:38
  • Can you post that files you copied from project A to B – Lekr0 Jan 27 '19 at 05:40
  • Hi @Tedinoz, what do you mean by that ? – sarah. isml Jan 27 '19 at 05:40
  • @Lekr0 I have edited the question, and attached images – sarah. isml Jan 27 '19 at 05:49
  • @sarah.isml I mean that the error "_package R does not exist_" is covered in several StackOverflow posts and your question could have already been solved by the linked post. You might re-read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). You are expected to have researched your question and "...and keep track of what you find. Even if you don't find a useful answer elsewhere on the site, including links to related questions that haven't helped can help others in understanding how your question is different from the rest." – Tedinoz Jan 27 '19 at 06:00

1 Answers1

0

This is one of the most common errors you get when you copy-paste Java classes from one project to another.

What you need to do is: You need to copy those three classes right? So, in Project B, make three new classes of the same name and each time copy paste the code of those three classes from Project A, just excluding the name of the package, which is in the first line of every class. Then compile the project B. Your errors should be resolved.

Costa
  • 472
  • 4
  • 6
  • Thank you so much for your suggestion, I will try and update you soon. Also, do I need to copy the ‘import’ part from Project A as well ? – sarah. isml Jan 27 '19 at 07:17
  • Yes, please copy everything except the package line on top of the class. See if it works :) – Costa Jan 27 '19 at 08:34
  • I have done it, but now I got error such as "cannot find symbol variable ocr_capture", "cannot find symbol variable preview" and "cannot find symbol variable graphicOverlay". is there anyway I can show you the image of the error – sarah. isml Jan 27 '19 at 08:47
  • Yeah, just edit the question and include the image of the error. – Costa Jan 27 '19 at 13:30
  • Hey, saw the error. Check the layout file of this activity, OCR activity. You must have some different named XML file for this activity. Just change the name in setContentView in the java class according to the name you have in the XML Layout file for this activity. – Costa Jan 27 '19 at 16:38