Zbar R cannot be resovled - android

I have just imported the zbar example project into eclipse. I have started the AVD, but when I go to run the zbar example I get a pop-up saying there are errors in the code.
When I went looking for errors the only ones I could find are the ones shown below
I removed the project from eclipse and re-downloaded the zip file and imported it all again but still have the same results. Has anyone else run into this problem ?

There are 2 R classes now in your app:
your own's app R class (from your app's namespace).
zbar's R class
You should either sort out the import instruction to make sure you import the right R class or use a full namespace in front of R.

The issue was with the wrong target build platform being selected when I was importing it.
Solution:
Right click on project->properties.
Select Android on left panel.
Tick Android 4.4.2

Related

install more then one apps in one apk or make two project one?

i making an application ,there is an other app that i want to add to my project, it is a source code and i allow to edit and add to the app menu of my app , but i get too many errors and its not fixable.
remember: i don't want to create an other manifest.XML or add another icon to menu if i could fix the errors i would added them to app menu because its working in its own project, i want a new app install with my app.
1. is there a way that the installer install more then one app? it would hep a lot
if not perhaps you can help me fix it this way:
error:
i add the package(java files) of the app and i have access to its file, all the XML are added and if there is an error i tried to fix them, i didn't run the project because i was shore i get errors , i fixed all that i could but now i get an error like this:
now i think i have to import its R class but then , all of values are in the XML and there is no need to bring the R class:
its own R class with suggestion of android studio:
import com.softwaredownload.app.R and R is red when i run it:
Error:(75, 25) error: package R does not exist.
ops! why do i get error for my own package Java files ?! i also clean and rebuild and restart the android studio. i mean when i added them at the first place and i fixed the errors at the top of them was the green mark that there is no error.
also , all of the project files are added the proper way but they are not working like the source code, i mean all the XML files are edited and fixed.
No, you can't install another app in tandem with your own app
Remove all the.old.package.R-import statements from the top of your pasted classes
Rebuild/run the project
Android Studio will then suggest importing your own package's R.class. Accept this recommendation. This requires that you've copied all resources (not just the layouts) from the old app into your new app.
i fixed the error like this:
it is impossible for two app to add to one installer APK but i just edit them both and i added them to the project than i edited manifest.XML and add two icon to android menu.
2.there is no need to bring the R class , it was an android studio error that fixed.

Errors when importing someone else's projects - Android/Eclipse

I have been using Eclipse for about 6 months now, and I noticed that I rarely can import someone else's project into Eclipse. I get so many errors in many files. For example, I tried to import a friend's project that I know works just fine, but I get a lot of "R" errors, like Eclipse can't recognize "R" as a field, and then other weird ones like ActionBarActivity is not recognized or an entire imports like android.support.v4.app.Fragment that visually are in the library but are not being recognized by Eclipse as being there, and I check them and they are definitely marked "Is library" and added properly to the project. Anyone know why this is or how to fix? It's frustrating because to learn, sometimes you need to see someone else's app run first, then look at their code, but you can't. Thanks in advance.
My usual way of importing a project is to do File -> Import -> General -> Existing Projects into Workspace. Also, I have tried cleaning the project, but it doesn't work.
try this File -> Import -> Android -> Existing Android Code into WorkSpace ->then browse-> select your project->make sure the checkBox"copy the project into workSpace" is marked
Check your Build Path. In the Android Section, try using some other API level click on Apply and after your project finishes with the building workspace, again revert back to the original API and click on OK.
Also check for any Build Path errors.
So thanks to the help of everyone of this post, and others on another post, the problem was finally fixed and took several steps.
Turns out that the ActionBarActivity error had a quick fix (hover over it, you get quick fix options) of importing the appcompat_v7 library. I never chose that before, because I thought it was already installed, hence the conflict with android-support-v4.jar (meaning there were doubles of that library), but I chose to import it anyway and that error went away.
But I discovered that android-support-v4.jar was actually a component of appcompat_v7, so that was causing the "Jar mismatch!" error in the console. So I deleted android-support-v4.jar from the libs folder, and the jar mismatch went away.
Lastly, my layout files were all not being recognized, even though I knew the variable names were all correct. So the error was from when I tried to refresh my imports in the very beginning of the problem (using shift+command+O), thinking it was an import problem (which it was), but at that time, refreshing did nothing. BUT... Eclipse took away import com.laurengariepy.android.gridimagesearch.R; and replaced it with android.R;, which is what was causing all the layout errors. So once I put that com.laurengariepy.android.gridimagesearch.R; back, then all errors went away.
So the take-away to this story, is be careful with Eclipse version 22.6. The auto-import of the appcompat_v7 library will cause a lot of trouble when you try to import other people's projects, because they were likely not created in an IDE with appcompat_v7 already there.

How to share an editable android project with git and sourcetree

I need to share an android project with another pc and still be able to edit it on both sides.
For some reason I can't get this to work. I have tried a lot of different combinations to import it and still be able to edit and push changes.
When I try to import the project into my workspace, there is a lot of errors like this:
the type java.lang.object cannot be resolved. it is indirectly referenced from required .class files
Then I tried importing the JRE System library (JRE 7)
After doing this I still get errors. for example this:
Activity cannot be resolved
Then I imported the Android library to the project (API 18). But after doing this, there is a red cross on the project, but not in any classes, files or like..
Therefore I tried to clean the project, which removed the "R.java" and gave me a bunch more errors.
I don't know exactly what I am doing wrong here so I hope someone can help me out.
What is the "right" way to import eclipse projects and still be able to edit and push/pull?
(Btw. I am using BitBucket and SourceTree and trying to import it into my eclipse workspace. )
Found out what was wrong.
By navigating to "Window > Show view > Problems", I found out that the necessary API wasn't available at that eclipse version. So I downloaded it the software and it worked.

Importing and using a library in android studio

I am using android studio to import this project called https://github.com/Pixate/pixate-freestyle-android. However when I import it into android studio the folder under samples, freestyleshowcase doesnt seem to build. The other 2 samples buld correctly. There is a red circle around the java file with a J (error) but there is no error in the file itself. COuld someone please help me out?
You are obviously missing some libraries but it is going to be hard for anyone to tell you which since we do not know the libraries the project needs.You can try Build-->Rebuild Project or Build-->Clean Peoject if it still doesn't work, close and open Android Studio.
If that doesn't work also then you have to go the hard way of identifying the libraries need by the project samples you imported and see if you have them.
When in doubt, you can try the Library Dependency option (using Maven) as demonstrated here:
https://www.youtube.com/watch?v=6BUcx9gGQ3o
That way, you won't have to manually edit the build.gradle file.

Error when importing com.google, com.android.internal.Telephony, etc

I've downloaded the android source code for CallLog, Contacts, Dialing from here.
But now, when I try to import this package on Eclipse, imports like:
com.google,
com.android.internal.Telephony,
com.android.internal.R,
com.google.android.collect,
android.provider.ContactsContract.Intents.UI,
android.provider.ContactsContract.SearchSnippetColumns,
android.provider.ContactsContract.ProviderStatus,
android.provider.ContactsContract.ContactCounts,
android.content.IContentService,
android.provider.ContactsContract.Intents.UI
And many other imports, show errors saying it cannot be resolved.
So my question is, why it shows this errors? Why I cant implement it without this errors? I use the Google APIs, I've created the project from an existing source code, but I dont know why this happens.
If you're sure that you have set up the Android SDK correctly, you should try to 'clean' your Eclipse project.
This usually solves import related errors in Eclipse for me.
Try right clicking the solution / project in the project explorer and choose "fix" near the bottom.

Categories

Resources