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.
Related
I have a problem with the import of my company's project into Android Studio.
First of all, we have a project which contains desktop clients (Java) and mobile clients (Android). The project structure under Eclipse runs fine.
But since Eclipse and ADT is not longer supported by Google, I thought it is time to switch to Android Studio (I am the first one, who is trying this).
Our project (trunk) has a structure like this:
10 Folders which doesn't contain relevant code for the Android Client
mobile (Android based code)
projects (Android xmls, manifest and all other non-Java stuff)
sharedContent (pure Java)
"mobile" contains all the specific source code for the Android client.
The "projects" folder contains a folder "android", which contains all necessary xml-files and the manifest.
The "sharedContent"-folder contains a "sharedME" folder. The code from the "mobiles"-folder uses some code from the "sharedME"-folder.
This three directories are required for the Android client.
The main problem is, that I am not allowed to change the project structure to one, which is more suitable for Android Studio. The reason is, that at first the package declarations wouldn't be correct anymore, and secondly other important code from the project will have problems with the changed structure.
Since we used to import the trunk with SVN, everything worked fine under Eclipse. But I can't integrate the code successfully in Android Studio. I tried many different ways (and tutorials), but none of them worked for me. Note, that the import into the workspace seems to be no problem. But when I am trying to build the project, Android Studio shows me several errors.
I won't show you, what errors I am receiving, because they would be from many different approaches.
I want to start from scratch by asking you, how you would import this project structure with given setting into Android Studio. Maybe I tried the right way, but just made something wrong.
The most favourable solution would be, when the project is connected to the SVN, so that we are able to commit or checkout changes from the SVN directly from Android Studio. But since this doesn't seem to work either, it is ok to commit them manually from the workspace.
I am glad for any suggestions. Just post your ideas, and I will responed with the error output I get or if the solution was successful.
EDIT:
I imported the three most important directories with SVN into Android Studio. Now I have three modules: "android", "mobile", and "sharedContent"
The only error I get is "cannot find symbol, symbol: class R". R is located in android->gen->com->...->project->R. The error is created by the files from the module "mobile", to be exact from mobile->android->com->...->project->A random Class.
Is there a way to point to the R-class, which is located in another module?
Android Studio shows the error at first in the import, like "import com. ... .project.R". I set them as sources, but it didn't work, yet.
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.
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.
I have searched through Stack Overflow as I know this is a common question, but none of the solutions seemed to work for me. This included cleaning my project, deleting all imports and deleting the project and starting again entirely.
I am using the Eclipse specifically for android on mac (ADT bundle mac).
Whenever I create a new project I have errors immediatley in my src folder on the line
setContentView(R.layout.activity_main);
and also on inflate.
Any suggestions other than those stated? It is literally before I have done any programming so cannot understand what is wrong.
EDIT: Fixed. Downloaded the SDK a second time and this seems to have fixed it.
import The R class. The basic syntax is
import your_application_package_name.R;
If you have already imported it but it is not working then check if there in any error in your resource xmls. If so then r can be not generated and that error will be shown
Change your Project Build Target to the Latest
Right Click Project > Properties > Android > Change the Api to latest version
Try to update the Android_SDK. When you create or import a new Android project the SDk builds the project. The R problem is mostly an update SDK problem.
I'm trying to build Google's open-source Calendar app for Android (source here: https://github.com/android/platform_packages_apps_calendar), so that I may pick apart its code a little bit. When I import the freshly-cloned project into eclipse, I get a bunch of ____ cannot be resolved to a type errors. Looking closely at the types that aren't resolved, the root cause seems to be:
The import com.android.common cannot be resolved
The import com.android.ex cannot be resolved
I've been googling and I can't seem to figure out what's going on? I must be missing some library? I have everything in the Android SDK Manager installed, even the optional libraries. I've tried cleaning and fixing build path properties, etc. The errors remain.
Anyone have any idea what I can do to get this thing to compile?
I have managed to add almost all the required dependencies and now i got an almost-running version.
Kindly, check it out from here
You can also check the last commit, it contains all what i did to get this running version.
Have a nice day :)