Missing file R.java when creating ZXing library for my app - java

I'm trying to add the QR scan to my android app. I already know that it's advised to use the Intent method, but the app it's a university project and, therefore, we need to integrate it.
So, I downloaded the pre builded core.jar and the Zxing sources (version 3.0.1), then I created a new Android project with the files in zxing-zxing-3.0.1/android, and then added the core.java in the libs folder and in the build path.
Basically I'm at step 5 of this guide.
The problem is this: my errors do not disappears because the file R.java do not shows up.
I'm using the Android Developing Tools with Eclipse.

R.java is generated by the Android SDK build tools. You didn't build the project yet.

Try these:
look for errors in your layout XML-files
clean your project

Related

Downloading a libgdx Project Gradle Problems

So my friends and I are making a game for Android and we are using Android studio. We are using libgdx. We are also learning how to use github. Anyways, using Android Studio, I uploaded the basic libgdx setup. The one that just displays the Bad Logic image. My friend downloads it from github using Android studio but there are errors everywhere. It says that it can't find the badlogic package and it gives the following error:
This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
I know that libgdx uses gradle. So what is the problem? Why can't we simply upload and then download a simple project?
Thanks!
Try to remove the .gradle directory and re-import the project or use the Setup App Installer from here to create a new gradle project.
Thanks for the help! I finally figured it out.
Basically, when I imported the project, I was just importing with existing project files. These are the steps I took to get it fixed.
Check out from Version Control using Android Studio and the welcome screen.
When asked to open, say NO.
Go to the folder that is associated with the repo.
Create a local.properties file there and in that file it should have
sdk.dir = /YOUR/PATH/TO/SDK/HERE
Then go back to Android Studio.
Click Import Project and select the folder that has it in there.
From then on, it should work forever as the .gitignore file that is generated by libgdx will ignore the local.properties file when pushed. I hope this helps someone!

How to add exisiting java source project to Android Studio

I have an existing git repository of pure Java code that I would like to add to my Android project.
I don't want to change any of the existing files. I want to keep my existing package names to simplify the maintenance of my legacy code.
In Eclipse, you can simply add the root of the existing project to your Java Build Path.
How to do the same in Android Studio?
I'm not sure this will help or not. But you may check these.
https://developer.android.com/sdk/installing/migrate.html
Unable to import Eclipse project to Android Studio
How to import eclipse project from git to Android Studio?
My solution to this was to Export my Java project to a JAR.
And then, I added the JAR to the Android Studio project.
File > Project Structure leads to this window:
That way, I could use my files untouched as such.
I am not so happy with this solution because it breaks my revision control system.

In Android project include another project

I'm just starting my long way to Android programming and building app where I would like to use this library https://github.com/cfgxy/DevsmartLib-Android/tree/
This is another Android project, how should I include this in my project using Eclipse?
The contents of that repo's devsmartlib/ directory appears to be an Android library project. You can use such projects from Eclipse or from the command line as you see fit.
Create a new Android project in Eclipse and select the contents of devsmartlib/ as the source folder.
You can then right click on your project, click Properties, Android and add the library project from there!

R. Java file is not created in Android Application

R.java files are not being created in my project.
I have tried solutions like clean the project,removing .jar file from java build code.
Even though it is not working properly, how can I fix this?
Sounds like you're either not using Eclipse, and/or not using the Android eclipse plugin.
Take a look here: http://developer.android.com/sdk/installing.html
If you have not set android SDK then download and set sdk target
Try to clean your project and try to get error which type of error you are getting and solve it
Try to create a new project from existing java, xml, menifest and drawables
I think you are developing in Eclipse (java).
But you need to install the ADT Plugin (see here: http://developer.android.com/sdk/eclipse-adt.html)
After that you must download the Android SDK (Link)
In Eclipse you have to add the SDK.
Window->Preferences under Android -> SDK Location
Now create a new Android project or open an existing project like the API Demo.
The R.java file is generated automatically

Convert Android project to 'regular' Java project inside Eclipse?

Ive inherited some code which started out as an Android project but really is just an API to be used by other applications. Hence, the 'build' process usually just produces a JAR file. The problem Im having is that I get errors from the Android build tools in my console which seem to fire everytime I make a change to some files. How do I fix that?
Im using Eclipse 3.5 (Galileo).
Check run configuration and remove any reference to the Android Sdk.
Create a new Java project and copy project files from the older Android project to the new Java one.
You should copy files: .classpath and .project from other working java project. Next you should edit .project with text editor and change SampleProject to YourProjectName

Categories