Android Library Project containing .jar - android

I have a Android Library Project containing all the classes and resources I need for my application. But when I'm trying to create a new android project based entirely on my library project I'm running into trouble.
The library project contains several .jar with their own xml:schemes resulting in the following error :
error: No resource identifier found for attribute 'hideMethod' in package 'my.library'.
Iv'e tried to copy the attrs.xml into the new project/values folder but I'm just getting an "Attribute already defined" -error.
If you have some tip to point me in the right direction it would be great.
Thanks!

Compile your library proj. which will generate .jar in its /bin folder. Then from your main project, go to properties>Libraries and add path to the .jar file of your library proj. Apply clean build of your main proj. It must be solved your problem. I also faced the same problem.

Related

FacebookSDK mismatch

I want to do Login with facebook.But when I am going to Create a new Android Project with Facebook Login I got the error of the Jar mismatch.
when I create new android application that time there is no any errors, but when add the FacebookSDK to the newly create project. that time it gives
Jar mismatch! Fix your dependencies | Unknown Android Dependency Problem
I tried everything to change the java compiler level but not getting.
I tried project properties > Java compiler > In this level I do all changes of the java versions, but not success.
any help please?
Thank you.
its mean there is multiple jar file(with same name) in you Project and Library Project. just Delete that jar file form Project.(not from Library Project)
or rename your one of jar file.(i ll sagest you delete jar file instead of rename)

why isn't my included library project recognized in xml file? Using Library Projects correctly

I need to use a library project in my project.
But for some reasons a
referenced XML prefix is not recognized.
Here are the steps I did to add the library project:
Project -> properties -> Android -> added the library project
in my project created a folder lib_src -> Build Path -> Configure Build Path -> Link Source (to the src folder of the library project)
But the problem is that a used XML reference to the linked library project is not being recognized.
Please help - what did I do wrong when trying to use this library project?
this is the xml file portion in my project with the unrecognized reference:
<org.taptwo.android.widget.CircleFlowIndicator
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="#+id/viewflowindic"
android:layout_gravity="center_horizontal"
app:inactiveType="fill"
app:fadeOut="1000" />
where <org.taptwo.android.widget.CircleFlowIndicator causes the problem.
However I have a linked library folder lib_src with the sub-folder:
org.taptwo.android.widget and the contained class file CircleFlowIndicator.java in my project.
I also have exactly this folder added to my build path.
Please give some advice what could be the reason that I keep getting the problem:
Error parsing XML: unbound prefix at <org.taptwo.android.widget.CircleFlowIndicator
Many thanks!
I'm not sure that your second step of manually selecting a source folder is necessary.
I think the point of the library referencing in the project's properties is to sort it out for you automatically. Try following the steps exactly as they are here:
http://developer.android.com/guide/developing/projects/projects-eclipse.html
Perhaps a clean and build in Eclipse of all the projects involved might help if your settings are correct.
(Also, you didn't mention selecting 'is library' in the library project's properties, so make sure that's done if you haven't already done it)

Refrencing android project with another android prject

I have a problem that I want to reference with another android project, I am generating jar of one project and included that within another project but there is an error as Error generating final archive: found duplicate file for APK: res/values/strings.xml
How it can be resolved?
Convert one project to a library project and reference it from the other project.
Maybe you want to use an android library project.
Go to the projects preferences and check "Is library project".
On the main project, simple add the library project you just created.
That should resolve this.
Library Project in the Android docs

Android library projects

I created a libray android pakage i included a external jar (apache.commons) i marked the project as library.
I create a new android project add library under andriod tab add project under source tab build it and it builds fine. As soon as i call something out of that class i get a java.lang.NoClassDefFoundError.
What is going on. I tried adding uses-library but then i get shared library not found.
My permissions is the same as the library project. There is no activities in library project.
thanks
Android Library project are, basically, 'inclusion of the src and res files'.
Nothing more...
So included jar should be included in all the project...
At least, it is how I've seen things while working with Android Library Project

How to fix "Error generating final archive: duplicate entry: AndroidManifest.xml"

I put two projects into Eclipse, called Project1 and Project2.
Project1 is independent, but Project2 must be dependent to Project1.
When I build the Project2, the error msg comes like this: Error generating final archive: duplicate entry: AndroidManifest.xml
I figured out what the problem was. I included a JAR file that had an AndroidManifest.xml file in it, which was conflicting with my own project's AndroidManifest.xml file. The solution in my instance was to rebuild the JAR file, making sure it excluded its own version of AndroidManifest.xml, then to re-include the new version of the JAR file into my project. You might need to clean the project after doing this.
I think you use Project1 as Library. So, when you export jar file you should unselect AndroidManifest.xml on "Select the resource to export".
I had got the same problem some days ago, if you put a JAR inside libs folder and the JAR has inside a AndroidManifest.xml you got the error. If you put the JAR outside the project (for example on desktop) and in "java Build Path" you use "Add external JAR" the problem is solved.
I got a second (ungracefull) AndroidManifest.xml file by including an Android.R package instead of the com.example.mypackage.R.
Symptoms: build seemed to work, but launching showed the existing Error in workspace, which needed to be fixed first.
One AndroidManifest.xml was found in classes, the other in a file called resources.ap_ .
I simply quickfixed (include android.R) workspace to hell.
edit: didn't work either, workspace still in in hell; problems in projects, which liked to be fixed...
edit1: can't find the package, with should hold the AndroidManifest.xml.
edit2: I consider to assume the second Manifest File in Android.jar - seems like each Manifest file results in generated 1 R.class. I erased complete workspace. Because it was playground anyway. (Then I set up Git.)
Cleaning the Project1 might help.
It is possible that you have similar compile time dependencies in your library project and your application project and the dex-er is not recognizing the duplicates.
If this is the case change the scope of the dependencies in your application project to the provided scope.
The dependencies will be included because they are in the library project, and they will not be duplicated because they are "provided" when compiling the application project.
You will get a series of error message related to AndroidManifest, main.xml, activity_main. So the best solution would be, rename them (using shift+ctrl+R) from one of the project to something else.
This solved my problem.
I could only fix it in Android Studio by deleting the out/ directory and letting it re-build everything again.

Categories

Resources