Import Android project using Eclipse - android

I'm having trouble trying to import a project. After doing so I get 6 error items. Of which 4 are the same (Unable to resolve target 'Android-8').
Another one is: Project 'MyProject' is missing required Java project: 'org.json'.
Even though the file org.json.jar is in the libs folder.
And the last one is: The project cannot be built until build path errors are resolved.
What can I do to make Eclipse properly import my projects?
I even tries to create a new project and manually copie the files, but didn't turn out as expected.

To import the existing project
Project Explorer-->new Android Project from Existing Resource-->select project and check copy to the work space option(if you need)--> finish.
Problem
Unable to resolve target 'Android-8'
Right click on the project-->android-->select the target as 8 and save.
org.json.jar
Download this jar from the internet and paste the jar file in the lib folder.
3.Clean the projec once

Unable to resolve target 'Android-8'
You dont have Android-8 SDK installed on your pc.Concider downloading this SDK or if you have any SDK above this version just select it. under project properties.
Project 'MyProject' is missing required Java project: 'org.json'
This message suggest you that this project is expecting org.json library project in your workspace and you should include it as library project.
If you have got jar file then its fine,under project properties just remove library project dependancies and include jar file in build path.

How have you installed the ADT?
It's possible that if Android options aren't available, you haven't installed the ADT plugin correctly.
I would do the following:
Ensure that the ADT is installed
Delete the project and re-import it under the option "Import existing Android code into workspace"
Check that the build path options are correct. Android projects add jars in the lib folder to projects automatically, but this is worth checking.
Keep us posted!

Related

How do I add the appcompat library to an android project in netbeans?

I have the support libraries installed via the SDK manager.
I have copied the C:\Program Files\Android\android-sdk\extras\android\support\v7\appcompat folder to my projects libs folder.
I have added the \tools folder of the sdk to my command line path. I have then run
android update project --path . --library C:\Users\srayner\dev\android\AndroidTest1\libs\appcompat
But now netbeans gives me this error;
Failed to resolve library path: C:\Users\srayner\dev\android\AndroidTest1\libs\appcompat
What is the correct method to setup an android support library with resouses in netbeans?
I have successfully build and added the appcompat project in NetBeans.
Create a new android project in netbeans - I called mine "appcompat".
Build your new project just make sure it can be successfully build.
Delete everything inside the src directory and rebuild. My project just contained the default MainActivity that was created by NetBeans. You don't need it.
Navigate to your android sdk install directory
"androidSdkPath\extras\android\support\v7\appcompat and copy all
the contents within that folder
Paste the copied contents to the android project that you
created in step 1 (again mine was named as appcompat).
Very important - Open project.properties and ensure that the "target" property matches the following: "target=android-21"
Build your project and Voila... you should be all set.
If you are still having issues compiling the project that will be using the appcompat library, change your project library properties target=android-21"

Project library not getting added to android project

Iam trying to reference a Android project library to my application. I do this:-
1)File->Import->General->Existing project into workspace->Select project library->check copy to workspace.
2)Right click on project->Properties->Android-> Add-> Select project library-> Apply-> ok.
But when I again check if the library is added I get the following:-
How do I resolve this?
Make sure that your library has the same location with your project source files.
It means that if your source is on your workspace , then your library should add into workspace. If not, you should copy your lib into same folder with source then mount it again.
Make sure the library project is checked as a library.
Go to the library projects BuildConfig -> Android -> Check "is library"
Make sure your project and the library project have the same target/min SDK versions.
It's also a good idea to clean your workspace and Build the library project - Right click on library project -> "Build Project"
Try this answer:
The project name needs match the folder name on the file system. What you are seeing in the Project Properties->Android->Library Reference is a relative file system path.
Reference:
In eclipse, unable to reference an android library project in another android project
Thanks to archie-bpgc for comment
i am also facing this problem i have solve this problem like
when import lib in to workspace tick mark as show in picture (basically library project and your project both are in same workspace)
now add lib to your project and clean project
you need to import the project to workspace and the library file into the same workspace.
Then you will not face this error. Kindly the root cause is not known. But this method works.
After all this .. one more way is you can alter the project properties last line where the library file path is specified.
Thank you.

import errors in android

I imported a project. I see import errors in each file. In the problems view I have the following errors:
Project X is missing the required source folder 'Gen'
The project can't be built until the build path errors are resolved
Unable to resolve target 'android-10'
In my package Explorer view, I don't see the gen folder so that I could tweak it.
What should I do, i am new to android.
check whether you have android-10 version installed.
Clean the application
Right click on project -> select Android tools -> Fix project properties
Re build the application.
Try to delete the folder (if it exists) and do a Project Clean in Eclipse. Mostly this helps to recreate your gen folder.
You can try to recreate it manually and make it a source folder, too!
Make sure your project build target and API level you're using match.

Adding Android jars to Eclipse Build Path

I am using Linux Fedora 16 OS. Eclipse Indigo.
Android SDK as well as its associated Eclipse plugin have been installed successfully.
However, when I imported a sample project I downloaded, the build errors indicated that the compiler could not find the Android classes in the classpath, i.e. the Android jars did not automatically get added to the Eclipse classpath when installing the plugin.
I tried adding all the jars that are in the /android/tools/lib directory (like a lot of them) but that didn't do it.
So I am wondering if this jar(s) need to be downloaded separately, i.e. are not part of the SDK package (which seems doubtful).
Error example:
android.app.Activity cannot be resolved to a type
in Eclipse when you have import as project of android ,check root directory of you project and check it have following thing in it ,like below
.project
AndroidManifest.xml
if your imported project of android doesn't have .project then you should import project like below step :
in Eclipse go to:
File-->New-->Android Project -->now you have some option to check if you want to add Project that have already source code then select Project from exiting Source and find your Project root directory.
Now one more thing when you have imported project Right Click on Project root Directory and Click on properties go to Android -->then if there is no selected build target then select one of Android Target as your required.
Yes, I faced this issue too. Sometimes, while importing android source code eclipse does not add android framework jars to build path. In that case open the .classpath file (It will be in the root folder of your project) and add the line
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
after the source classpath entries. Refresh, clean and build the project. You will find android framework added to your project's build path

Jar from library project not resolved in Android app

I'm building an Android app which uses a library that is defined in another Eclipse project (same workspace). All is working fine, but now I added a jar file to the library project's build path. In Eclipse I exported the jar file to make it visible to dependent projects of the library (Build Path -> Order and Export -> mark the jar file). Still Eclipse (ADT) complains that the import cannot be resolved.
I have set up a test project for the library as well, and there the imports are visible after exporting the jar file as mentioned above.
Is there anything I forgot to configure?
Regards,
Martin
ADT doesn't seem to pick it up automatically :-/
Manually configuring the main project's build path to rely on the library project's jars worked for me.
Build Path -> Libraries -> Add JARs -> {Library Project}\libs\myjar.jar

Categories

Resources