I have tried to use this tutorial and when I clicked finished, I have noticed that the src was empty, screenshot below: The facebook project in my folder is complete, so my question do I need to manually copy all the files to the folder? And why was this empty?
Edited:
I'm using Eclipse Indigo and Android ADT Version 18.
After you have created your project with empty folders do the following:
1) Right Click on the project
2) Click Import
3) General > File System
4) Select the "facebook" folder that is inside the downloaded package
5) Check mark the facebook option
6) Finish
This will import all the files that are part of the facebook project.
Aside from this tutorial as this method is somewhat chaotic, there's some other way by going to Right-clicking your project -> Build Path -> Link Source -> Browse to the "facebook" directory, and that's it, hope it gave you all some idea.
Related
I'm followed this IBM Worklight article instructions -
link.
On Eclipse - when I try to run BarcodeScannerSampleBarcodeScannerSampleAppAndroid -
I get message box with title - "Android Launch", that says:"Your projects contains error".
At Markers window I get this Error:
The container 'Android Dependencies' references non existing library
'D:\Users\MyUser\workspaceNew\CaptureActivity\bin\captureactivity.jar'
BarcodeScannerSampleBarcodeScannerSampleAppAndroid
Build path
Build Path Problem
Directory - "D:\Users\MyUser\workspaceNew\CaptureActivity\bin\" doesn't contains "captureactivity.jar" file.
Any idea?
Thanks!
Make sure you follow the instructions in the blog post to the letter.
It sounds like you did not follow the last step, which says to:
Right-click the generated Android project and select Properties
In the Android entry from the left pane, click on Add and select CaptureActivity
Fuller steps:
Download & extract the zip from GitHub: https://github.com/phonegap-build/BarcodeScanner/archive/master.zip
In Eclipse, File > Import > Android > Existing Android Code Into Workspace
Click on Browse and then find the extracted folder
Navigate in it into ../BarcodeScanner-master/src/android/LibraryProject and click Finish
Then you need to continue with creating the Worklight project. It's two different projects.
In your Worklight project, you need to navigate to your-project\apps\your-app\android\native
There you need to right-click on the src folder and select Import... > General > File System
Navigate to the same extracted folder, into ../BarcodeScanner-master/src/android and click Next
Tick the checkbox next to the android option that will appear after step 3
Next you need to configure AndroidManifest.xml and config.xml in the same location (your-app\android\native).
In both the CaptureActivity AndroidManifest.xml and the Worklight project AndroidManifest.xml I've set the minSdkVersion to 19, which I have installed.
Now,
Once you're done with that, build the project.
Right-click on the generated Android project > Properties > Android
Click the Add... button and select the CaptureActivity library
Make sure to not select the "Is library" checkbox.
Looks like you missed one step.
- First we need to import the Java facade to the plugin. This is the code that implements the
mandatory CordovaPlugin class and the exec() method. In the Worklight project, go to the
location for the Java code
BarcodeScannerSample/apps/BarcodeScannerSampleApp/android/native/src
- Right-click on the src folder and select Import...> File System
- Select the directory
<GIT CLONE FOLDER>/BarcodeScanner/src/android
Select File > Import, of type File System, the contents of the com folder from the same
source folder
<GIT CLONE FOLDER>/BarcodeScanner/src/android
You should be able see that the com.phonegap.plugins.barcodescanner.BarcodeScanner.java
file has beenimported into the src folder.
And make sure you configured the config.xml and AndroidManifest.xml properly.
You can find the file here: https://github.com/phonegap-build/BarcodeScanner/
Click on "Clone in Desktop".
Extract the zip file.
Import the resources as following.
https://www.ibm.com/developerworks/community/blogs/WASFAQs/resource/BLOGS_UPLOADED_IMAGES/scan_importplugin.jpg
Yaniv thanks.
The problem was in CaptureActivity library.
After importing "Existing Android Code Into Workspace", I should BUILD the project library.
Then it create a directory - "D:\Users\MyUser\workspaceNew\CaptureActivity\bin\" with "captureactivity.jar" file in it.
Thanks!
I am trying to import an example project into eclipse. I downloaded the file SlidingTabsColors.zip from here, unpacked it, and then choose
Import -> Android -> Existing Android Code Into Workspace -> Browse -> ...
and selected the project named 'MainActivity'.
When I try to run this application the Console gives an error:
Could not find MainActivity.apk!
I thought the purpose of eclipse is to create the apk file...
Anyway, do I need to do some additional steps in order to run this example?
Do:
New -> Other -> Android Project From Existing Code
This should work no problem. Android does create the APK upon a successful compile. If you run into any issues, just do:
Project -> Clean
Here is a step-by-step tutorial on Tab Layouts with Swipeable Views. Which is what I believe you're trying to achieve.
Download Link: Source Code
Hopefully this helps.
Make a New folder in your computer.
put the java and res files in that new folder
just rename the folder from java into src
copy the AndroidManifest.xml into the root folder
now try to import this from eclipse
I'm following this guide:
https://stackoverflow.com/a/10888882/1943607
Follow the steps below to add HoloEverywhere
Download Zip from GitHub to your computer UnZip the folder Go to
eclipse and choose File->New-> Android Project
Select Create project from existing source and then browse to the HoloEverywhereLib folder
inside extracted folder
Press Finish
Right click on the newly created project and go to Properties. Under the Android heading, you should see a section for Library with a checkbox IsLibrary. Make sure that's checked and press Add and previously added library ActionBarSherlock.
I unzipped the folder. Then went to eclipse -> Right click -> Import -> Android -> Existing Android Code into Workspace.
I select the unzipped folder and It's showing this:
When I click Finish:
And then if I create a new project, and try to import it, It cant find the library; I type org. and it isn't showing up the rest (org.holoeverywhere.app.***Activity). (Like its github says https://github.com/Prototik/HoloEverywhere#how-to-use-maven)
Can you help me out?
Edit: I've also tried to remove src from .classpath files with same result
Clone the repository using Github desktop. Install eGit on Eclipse. Then use import-->Git-->Projects from Git.
I try to follow the facebook-android tutorial from here: https://developers.facebook.com/docs/mobile/android/build/#sample
I am working in windows 7.
I have installed the Git and cloned the GitHub repository running this command in the git Bash -> git clone git://github.com/facebook/facebook-android-sdk.git
Everything seemed fine and I got the folder “facebook-android-sdk” in my “Users” folder.
But when I try to import the project in eclipse workspace so to use it as a library I cannot make it work. I’ve tried 3 things:
Create the project from existing source (as the tutorial says), when I browse to the “facebook-android-sdk” folder and create the project, I get this message in my cosole: [2011-12-04 14:01:49 - com_facebook_android] AndroidManifest.xml file missing!
Also in the package explorer, the src folder seems to be empty.
If I try to import the project when I browse the folder I get a message “No projects are found to import”
I also tried to make a test project where I copied all the classes of the android facebook sdk so that I can use them. It worked up to a degree, but it does not seem a proper thing to do.
So what do I do wrong? Is there something else I should do using the git repository (I am completely new to git)? Or is there something wrong that I do when I try to import the project? I’ve searched the problem here and in other forums but didn’t find a satisfying answer (or maybe I did not understand it). Please help!
EDIT: I've tried one 4th thing
4: I extracted the jar out of the project I created in 1 (even if it had an error). It is working in terms that I can compile the code of the facebook-android tutorial step 6.2 - https://developers.facebook.com/docs/mobile/android/build/#sample. So far it seems that everything goes ok. But I do not know if this is right or I should have problems in the future..
I had the same problem. But now I think I solved it, even if the solution is not satisfying.
Create the project from existing source as the facebook tutorial says. Then make a right click on the project and choose "Import", choose "General" -> "File System" and go to "Next". Now click on "Browse..." and choose the folder .../facebook-android-sdk/facebook. Repeat these steps with the src and the res folder (right click on these folders for "Import", choosing the src and res folder in .../facebook-android-sdk/facebook).
Now it works. I don't know why Eclipse doesn't import all these things automatically, in the past it worked fine...
Make sure when you select the “facebook-android-sdk” folder you add /facebook at the end. So type into existing source C:/Users/facebook-android-sdk/facebook and it should work.
Make sure that your code's directory is dropped directly in Eclipse's root Workspace directory. There seems to be a bug in the latest version that only allows this kind of import/load when all code is directly in a directory in your Workspace. Otherwise it copies just a couple folders/files from where you put it, and not the rest, and gets quite confused.
I downloaded the file in zip format from the git directory. I created a android project, then i imported the zip archive (import ->archive file). It worked for me.
If you want to import projects into Eclipse, you do not have to go down to the src folder, just do
File > Import > Existing projects into Workspace
then go to the directory where the folder is, say your Documents folder C:\users\Documents
then just click 'ok'
The window then displays all the folders in the Documents folder.
you can then select the project you want to import and click finish.
I'm pretty new to android, and just finished setup my environment and reading some tutorials. Then I got sdk samples from the web. Okay, what I wanna ask you is that is there a way to start a sample as a project in the Eclipse? I mean like clicking a project file in c# or a solution file.
Here is my folder which I unzipped the code,
\android-sdk-windows\samples\android-8\NotePad
There are three folders and one file in the folder, \res, \src, \tests, and AndroidManifest.xml
Or, do I need to make a new android project and import (or add files? maybe) them?
Thanks in advance,
yokyo
#sgarman
I don't think that's a very good way of doing it. Sadly the 'Create Project from existing sample' feature you describe functions in such a way that when it creates a project from a sample it leaves you editing the source code in the actual SDK sample itself instead of a copy of the source imported into your Eclipse workspace.
This is problematic for a number of reasons including:
Once you've edited the new project you no longer have the original sample to refer to, which is the whole point of the samples in the first place.
If you want to hack a sample in several different ways you will want several copies of the sample, but again once you've edited the original sample you no longer have the original sample to make a copy from.
If the SDK is ever patched then when you update it you may end up overwriting your code.
In short it makes far more sense to treat the SDK as a readonly reference and not treat it as a sandpit in which to do your own messing around. So imo the best way to create an Eclipse project from a sample is do take a copy of the sample and put it somewhere else.
If you want the sample to not exist in your actual Eclipse workspace directory then this is very easy. Just copy the sample to a new location and inside Eclipse with your workspace open do New->Android Project and 'Create Project From Existing Source'.
If on the other hand you want to make the project inside your Eclipse workspace directory then there is a problem which is that if you just copy the sample code inside your workspace folder and do 'New->Android Project' and 'Create Project From Existing Source' for me at least it fails with the error "Invalid project description: c:\Users\usernamme\blah\blah\projectname overlaps the location of another project projectname". I don't know why, if you create a project from sample code using 'New->Java Project' it works just fine so I suspect there is a problem with the Android Project Eclipse plugin that is causing this to fail.
There is a way to get around this which is to first copy the sample code to a temporary location on disk that is outside of the workspace directory. Then use New->Android Project and 'Create Project From Existing Source' which turns the temporary copy of the sample code into a project but leaves it orphaned outside the workspace directory. Then delete the project from the workspace (but without deleting the project from disk). Then use Import->Existing Projects Into Workspace with the 'Copy Projects Into Workspace' checkbox ticked to copy the project into the workspace directory, before finally deleting the project from the temporary location.
But ultimately I decided to structure my workspace in such a way that projects are not inside the workspace folder like this:
Eclipse Workspaces
\
Android Projects
\
Workspace
Project 1
Project 2
Java Projects
\
Workspace
Project 1
Project 2
Other Projects
\
Workspace
Project 1
Project 2
In this layout the Android Projects, Java Projects and Other Projects directories are conceptually my workspaces but in reality in each case it is the nested Workspace folder which is the actual Eclipse workspace. This enables me to keep my projects contained within their respective pseudo-workspaces while not being inside their actual Eclipse workspace folder which neatly gets around the problem of not being able to easily create Android projects if the project directory is inside the Eclipse workspace directory.
Sorry that's all a bit long winded, but it's taken me ages to work out how to get this to work efficiently and I figure it might help someone.
From eclipse go to: File > New >
Project...
Select the Android Folder and pick
Android Project
Then in the Contents section at the
top click the "Create project from
existing sample" radio button. Once
you pick a target from the bottom
the drop down will become selectable
and your good to go.
Copy the downloaded project into your workspace
i.e space allocated for android project
Open the Eclipse
Choose File---> Import ---> Android --> Existing Android code into workspace
Choose Next
Click Browse
choose the foldername (downloaded)
click finish
If you are using ADT 20 then it's quite easy. Select New > Other...>Android Sample Project > [Select the platform from which you would like to pick the sample] > You must see the available samples, select the one you wish to open,you will see that in your workspace.
This may not be a definitive answer because I'm relatively new to Android as well (and come from more of a .Net background too).
When you create a new Workspace in Eclipse, you'll see a new folder created with the name of your workspace and a .metadata folder inside of it. I don't think there's a "workspace file" per se, so you don't double click anything to bring it back up. You just open to that workspace (by telling the Eclipse dialog what path to open).
As far as importing existing projects into a workspace, copy the whole folder into your workspace and click File - Import... - General - Existing Projects into Workspace. Click the Browse button to select the Root directory and it should default to the Workspace's main folder. Click OK and the project should show up in the dialog. Select it and click Finish
The code samples don't come with eclipse project files out of the box. There are a number of ways to create them but the easiest is probably this. From eclipse (with the android plugin installed), File -> New -> Project, Android Project, Next, select the "Create project from existing source" radio button and specify the location of the existing source. The project wizard should then find your manifest and fill out the rest of the information it needs automatically.
http://developer.android.com/samples/index.html
It states here:
"Using Android Studio
Unpack the downloaded project package.
In Android Studio, chose File > Import Project and select the root folder of the unpacked project.
Android Studio may ask you to choose the type of project you are importing. If this is the case, make sure to choose Import project from external model and select the Gradle option."
I hope this helps you.