I am trying to implement Google Analytics in my android app for that I need to import one library. when I am trying to import that library it shows one error like
Could not write file: C:\Documents and Settings\ignite054\Desktop\i\Version
4\Project\PashuPalan\.classpath.
C:\Documents and Settings\ignite054\Desktop\i\Version 4\Project\PashuPalan\.classpath
(Access is denied)
How to solve this? please help me.
First copy the jar file from the android-sdk\extras\google\analytics_sdk_v2\libGoogleAnalytics.jar and add it into your projects libs folder.
The try to add library libGoogleAnalytics.jar to build path (in libs right click on libGoogleAnalytics.jar -> BuildPAth -> Add to Build Path).
Do not add anything in Manifest file and in your java file use Ctrl+Shift+O to automatically organize your imports.
Make sure that the directory and file is still there.
And, take a look that C:\Documents and Settings\ignite054\Desktop\i\Version
4\Project\PashuPalan is a valid path, has a .classpath file and it is readable.
Maybe .classpath file is hidden, removing the hidden attribute may resolve the issue.
Related
I have added an external jar file to my application.
When I remove my jar file the error disappears. But I require the jar file in my application.
I have also done clean -> build but the error still exists.
I initially added my jar file as app-> right click properties -> build path -> libraries -> add external jar.
Since that too generated the same error I directly copy pasted my jar file in libs of my application.
i.e in Android private libs -> native libs
Please can someone suggest what should I do to use the jar file and remove the error.
Thanks for your answer.
Add it as a Library under Project Property/Java Build Path?
I was working on my app, editing and coding some xml and layouts when suddenly I got an error on my libs folder. It's very weird because I haven't actually modified or changed any base classes or something. Moreover, I just noticed I lost also my R.java file and all of the references are gone.
What possibly can be the problem? I tried to clean+build the project but it didn't work.
Here is a screenshot of my eclipse:
http://i.gyazo.com/959040321d1fd6d00ee0b9a90133aa9c.png
Place the jar in the root folder of your project. Then you can add it to your classpath . (you cannot place a jar and access it using android.R)
You can add the jars to your build path by right clicking on your project->properties and going to Build Path. Then you can add an external jar
I am beginner in android. My client gives me a sample project as reference. In that project have an extra folder 'android dependency’ and that contain a jar file 'annotation.jar' .How can I add the very same jar to my project dependency folder? Any one please helps me!
Find "libs" directory in your project. Those will contain physically those jar files. Android Dependency will indicate that how many libraries are associated with current project.
When you find "libs" directory, right click on jar files, and you will find "Build Path" and then add them to build path. will solve your problem.
Edit
Go to the SDK Manager within eclipse (Window --> Android SDK Manager) and installed the Android Support Package which is found in the Extras folder.
Follow this: Project->RightClick->Properties->BuildPath and Add External jar then browse for particular jar file and Add.
Just copy it in your libs folder and refresh your project. Remember it should be libs not lib. Also remove it from your "external jars" path from Project->RightClick->Properties->BuildPath
Edit :
And also try this
Also remove android.jar file to your build path.
Hey I'm having a pretty basic problem importing classes into my Eclipse based Android app. I have included the class directory into the /src directory where I figured the classes would be easily included, but Eclipse is saying it "cannot resolve the classes".
One thing I noticed is that the project folder that I included and the subfolders are just regular folder and not package folder icons. Is that a problem? If so, how do I change them to packages? This is an external git repo, so I'd rather not do anything beyond just including them in my project.
Here are some pics of how I set up the project to help:
The Activity where the error is:
Here is the package structure in the project, and the package called "android-utils" where the files I'm trying to import live:
Here is how I'm importing the files:
Btw, these classes are just some utils and I'll be improving and adding to them during the development process.
Let me know if you need any in more info to help me get these files imported the right way. Thanks!
Did you try dragging the .java files from Windows Explorer directly onto the package in Eclipse you want to put the new classes into? It should then ask to copy or link to files.
As your folder contains only java files Add them as Jar File in your Buildpath project, and your problem will be solved.
Also your jar file you can put it under the /libs folder
see this link to lean how you create jar file
I'm working on an Android project and i need to import an XML library called XOM. The only way i found was to right click on the project name -> Properties -> Libraries tab -> click on "Add external Jar". But that only references it from it's original path, what happens when i compile the app and move it to my phone? Will the Jar be in there?
Might be a stupid question, sorry if that's the case.
It's fine to do that but what I normally do is create a folder called liband then add Jars from there. I find that makes it easier to see what Jars I have in my application.
The main disadvantage of your original approach is that what if the path to that library externally accidentally changes? then your program will not compile. It's better to have everything in the one place to make things easier.
.apk is nothing but a collection or zipped version of a file. it contains all the resources and compiled java files.
So you need not have to worry about the inclusion of your library files. if you have set proper path to your libraries in eclipse then these will be included in your apk file.
Create a directory called "libs" in your under your root directory. You can do it by,
Right click on the project which is in the Package Explorer window in
Eclipse.
New -> Folder -> give "libs" as the Folder name
Copy your jar file and paste it to in the "libs" folder
Expand the "libs" folder
Right click on your copied jar file -> Build Path -> Add to build
path
That's it