Refrencing android project with another android prject - android

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

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)

Android and Eclipse - referencing Library

What is the correct way to reference a library?
I start a new Android application using Eclipse.
I add a new Library application.
I add the project in the Java Build Path for the main application.
This compiles fine, but at runtime I get an error because the "library" file is missing from the main application, so my question is, what is the "correct" way to get the library into the main application?
I am used to Visual Studio, and referencing another project automatically ensures that the reference copies the required DLLs to the project BIN folder.
I understand that the library file's JAR/APK must be in the LIB folder, but does Eclipse do this for you when you reference it? It appears not - so do I import?
First you need to build your library project, and only after that add it into main project as library. Please follow this post.

Android Twitter4j giving error NoClassDefFoundError: twitter4j.http.AccessToken

I downloaded twitter sample application in AndroidTwitterSample repository and imported my eclipse. I am trying to run that sample application and i got the error: java.lang.NoClassDefFoundError in logcat.
The error is based on jar file missing.you must place jar files rite place.
Create a folder named libs inside the root directory of your project and put twitter4j jar inside.
Then include new jar via Project Properties -> Java Build Path -> Libraries -> Add Jars.
Remove any old reference to twitter4j jars.
Clean and launch.
I hope this will helpful to you.
see my post- No class defination found error even if there is no issues & let me know if this not working in your side.

Android Library Project containing .jar

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.

Why can't I add mopub-android-sdk as library?

I want to use MoPub for putting ads in my Android app.
I have downloaded the required resources and set-up a library project (mopub-android-sdk) in Eclipse. Now I want to add this project as a library to my Android app. But when I try to do that it gives this error:
Are the mopub-android-sdk files in the same parent folder as your project? This seems like the same problem addressed in this question/answer:
In eclipse, unable to reference an android library project in another android project
Place the referencing project in the same physical folder and see if the error persists.
To get around this, don't set up the mopub-sdk as a library project.
You can simply import it as a standard project.
Go to File > Import >Existing Projects Into Workspace, find the right project and click finish.
Right click your actual project and then click Build Path. Go to Link Source and then select the location of the project you just imported.
That should resolve the issue for you without requiring you to build a JAR.
-Franklin

Categories

Resources