Error when importing Android library - android

https://github.com/SimonVT/android-numberpicker
I am trying to use this library.
But I can't successfully use the Sample
Import sample
copy lib files (except manifest, build)
But the Sample still has an error at NumberPicker.java
I mean All(ever) R. giving an error, something like R.id.np_decrement, R.attr.numberPickerStyle, R.integer.np_config_longAnimTime...

Try this way
1st Download that project file
2nd Open the archive and you will see one folder with name android-numberpicker-master extract it to your hard driver
3rd In eclipse goto File -> Import and under Android tab select Existing Code into workspace
and import both the projects
NOTE: Both the projects must be in same folder
4th Right click on properties and goto android tab and see if project exists or add it
If the library and project are not in same folder then it will throw error, so both have to be in same folder
and now try to run it and it will work

The resources object (R.java) isn't being generated because of an error. Your targetSdkVersion should be set to at least 15 in your manifest, and you should also have theme.xml from the library's res/values folder copied to the same location in your own project.

First check out the sample application provided by the developer.
Right Click in your package explorer. Select Import. Select "Import existing Android Code into Workspace".
Browse to samples directory and import.
Similarly import Library and make it is marked as Library and other project is referencing it correctly.
Make sure JDK compliance is set to 1.6 and your project is targeted against SDK 15 i.e 4.0.3.

Related

How to import com.android.support:design:23.0.1 in eclipse

I am learning the android tab with swipe functionality using material theme. I have a sample tutorials from here and it is build from Android studio.
I am currently using eclipse for my project.
I am following the tutorial and i can't import the TabLayout from com.android.support:design
Below is the code,
import android.support.design.widget.TabLayout;
Showing the error, The import android.support.design cannot be resolved
I downloaded support:design:23.0.1 from here and imported to eclipse, even then the error appears.
Can any one tell me where to download and import the com.android.support:design:23.0.1 in eclipse.
Thanks
Install Android SDK 23.0.1
Import design library from sdk\extras\android\support\design into eclipse workspace
To mark the design project as Library, open properties -> Select Android ->Check Library
Now import this design Library to your Project from project properties.
This worked for me in Tab material design.
If the design folder is not found in the said location, try to locate it in sdk\extras\android\m2repository\com\android\support\design instead, especially for the later version.
I have also face same problem then find solution like this.
It work for me hope same for You.
First Step:- find .aar file for design-23.0.1.aar
E:\new sdk\sdk\android-sdk-windows\extras\android\m2repository\com\android\support\design\23.0.1
Second Step:- copy that file and rename it like design-23.0.1.jar to be extract this.
After unzip it you find classes.jar, res, AndroidManifest etc.
Third Step:- Create Library project in eclipse Named design and copy
classes.jar in libs folder
all res in res/
replace AndroidManifest.xml
and last add lib appcompat-v7 by right click on lib project -> properties-> Android -> add -> appcompat-v7
Most important do not forgot clean project and can be restart eclipse for refreshing eclipse.
And more deep details follow steps Guided by commonsware's blog
Create an empty directory that will be the home for the Android
library project. For the rest of these steps, I will refer to this as
“the output directory”.
Copy the AndroidManifest.xml, res/, and assets/ directories from the
AAR into the output directory.
Create a libs/ directory in the output directory. Copy into libs/ the
classes.jar from the root of the unZIPped AAR, plus anything in libs/
in the AAR (e.g., mediarouter-v7 has its own JAR of proprietary
bits).
Decide what build SDK you want to try to use. You might just choose
the highest SDK version you have installed. Or, you can use the
android:minSdkVersion and the -vNN resource set qualifiers to get
clues as to what a good build SDK might be. If desired, create a
project.properties file with a target=android-NNN line, where NNN is
your chosen build SDK. Or, you can address this in Eclipse later on.
Import the resulting project into Eclipse, and if needed adjust the
build SDK (Project > Properties > Android). Also, you will need to
attach to this library project any library projects it depends upon
(e.g., mediarouter-v7 depends upon appcompat-v7).
Good Luck!
And Special thanks to commonsware !!
A great fix to that problem is that you copy the sdk\extras\android\support\design\libs\android-support-design.jar file to "libs" folder of your project

Import "MPChartLib" Library to Eclipse

I tried to add "MPAndroidChart" library in Eclipse but when I try to import this lib:(https://github.com/PhilJay/MPAndroidChart/archive/master.zip) .
Amongst the downloaded files , I found a folder called "MPChartLib". This is the actual library folder, I need to add this folder to my project to be able to use the full functionality of the library.
I tried to import the library folder into my workspace, using File-->Import-->Android-->Existing Android but I have this message " Select at least one project eclipse import" !!!!
The lib uses gradle, because of that you can't "import a eclipse project"
You have 2 options, install a gradle plugin for eclipse, or use the lib as a jar
From the lib README:
Download the latest .jar file from the releases section
Copy the mpandroidchartlibrary-.jar file into the libs folder of your Android application project
Start using the library
I hope the same named file is already there or else you can do one thing check the file name to the New Project Name column and check the same file name in your workspace. I must say you that the same named file is definitely there.
So once you will find this, just rename your file name into your workspace and try again importing this.
I hope this will work for you. Any help will be needed, do let me know.
"Select at least one project eclipse import" this message inform you that you have already added Lib in Work Space check for already added "MPChartLib" Lib followed this step:-
Write click on your project and select Properties.
On left select Android.
In Android->Library section click Add
Select for "MPChartLib" (note: name can be change).
Or If you unable to find lib please make new workspace if possible then import MPAndroidChart on workspace.

Importing google-play-service library showing a red X next to this reference android

Am trying to add google-play-service library in my project using import(For Google map). After adding the path am getting red X next to this reference and the reference is not adding . Know how to resolve this ?
The red X means its a broken link path.
http://developer.android.com/google/play-services/setup.html
Copy the google-play services_lib library project to your workspace (folder where your android map project is). The library project can be found under the following path.
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib library project .
Import the library project to your eclipse
Click File > Import, select Android > Existing Android Code into Workspace, and browse the workspace import the library project. You can check if it is library project. Right click on the library project. Goto properties. Click Android on the left panel. You will see Is Library checked.
Right click on your android project. Goto properties. Choose Android on the left panel. Click on Add and browse the library project. Select the same. Click ok and apply
Eclipse does weird things when importing an existing project (google-play-services-lib), especially if you try to import and then allow the project to be automatically 'copied' to your workspace. I had the same issue and here is how I fixed it:
Close Eclipse
Erase all google-play-services projects from your workspace
Manually copy the google-play-services-lib folder (....sdk\extras\google\google_play_services\libproject\google-play-services_lib) into your workspace
Open Eclipse
Add a new project, choosing 'Existing Android Project', then navigate to your workspace and add the newly copied google-play-services-lib project
Finally, add the google-play-services-lib to your project as a library (just like you normally would)
Hope this helps! :)
Though it's over a year for this question but never the less thought of putting it down here. Might help some one facing a similar issue.
While doing a File -> Import one probably might have selected the folder,
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\
instead of
C:\adt-bundle-windows-x86-20130729\sdk\extras\google\google_play_services\libproject\google-play-services_lib
Quite strange as Eclipse did not correctly copy the google-play-services_lib project in my workspace, but this caused a cross mark to appear in my Project Properties.
got a perfect solution for your question. this problem is due to improper referencing of library projects. You need follow these step.
create a new project
copy all the java files from src of your previous project in which you are getting error to the new project you have created just now.
Also copy layouts xml files.
now import play services you will not get this error.
I was also getting same problem.
I copied google library folder into work space and import now it's working fine.
Try to place the Google-play-service library with in your same working Directory by coping the files from Click File > Import, select Android > Existing Android Code into Work space, and browse the work space import the library project.
This is common issue Youur google-play-service-lib project and your android project should be inside the same folder For example
if your Android Appplication name is MyMap is in D:/workspace t hen your play service lib project should be in the same directory D:/workspace
Close Eclipse. Delete
.metadata
and
.recommaditions
folders from your workplace. Import your projects back.
You add Project in to your workspace.
Start Eclipse and import project one option is ther copy to workspace do it.
After that add google play services it also copy in to your work space
and add it your library hope so its working.

Red exclamation mark over the project in eclipse

I am trying to run a project but there is a red exclamation mark over the project name. When checked in Problems, its throwing an error "project is missing required library". The library is pointed to android.jar located in some path. When checked in package explorer, I found the android.jar in Android 2.3.1 folder structure of project in package explorer. The android.jar located in Android 2.3.1 folder is pointing to some other path. Is the build error occurring due to the difference in paths for android.jar files? I have imported the project.So, how should I modify the path which is shown in the problems window? I am newbie to android and so pls help me.
Thanks!!!
The easiest way to resolve this common problem is to re-associate your project with an SDK version. You do this by opening project properties, clicking on Android, select a different SDK version to that which is currently selected (if one is selected at all), click okay, and then repeat the process to switch back to the desired SDK version, if desired.
I tried Phillip's answer and it didn't work in my case. Another place to look is opening project properties and clicking on "Java Build Path" -- if your project used some external JARs, check to make sure the links haven't been broken. If they have, reimport them again and remove the missing ones.
Import your library through the option: File/ Import... / Android / Existing Android Code Into Workspace, and not by creating a New Project and referencing the other (if you did this way).
I had this same problem and solved that way. As example, there is a PDF which demonstrates how to import other projects [Look at the page 28] (The material are in Portuguese)

Importing android source code as a project in eclipse

I have downloaded an android sample called custom view from android refernce from this location
http://developer.android.com/shareables/training/CustomView.zip
It only has the java files and other resources but does not contain any project file for me to import in eclipse as a project.
So when I import existing project into workspace, eclipse does not pick the project in the import dialog.
How can I import it into eclipse ? I have ADT tools installed already,
Thanks,
Ahmed
Maybe that's because you'll have to make the manifest.xml file.
What I'd suggest, is to create a new Android project, with the same package and Activity's name than in your zip (ie com.example.android.customviews and MainActivity), then copy/paste the files from your zip to the new project directory (thus replacingsrcandres` folders). That way, Eclipse will generate the manifest for you, with correct reference.
This should not take more than 30 seconds...
Go to Project Explorer and right click -> Import -> Select Android -> Existing Android Code Into Workspace -> browse to folder with your code -> finish
I encountered the same problem. I did thought that it's missing the AndroidManifest.xml file. I tried to fixed it and place it here. You can download it an try.

Categories

Resources