export an android compound view as library - android

I want to export my compound view as a library for reusing. I do it as follow:
Right Click on project> Properties > Android > And check Is Library
And copy exported jar file to a new project and add it to the library, Now when I want to run my project eclipes throws an error:
[2014-10-11 11:31:18 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v7/appcompat/R$anim;
[2014-10-11 11:31:18 - khonemojaradi] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v7/appcompat/R$anim;
According to error I know that I have same libraries that are there in my compound view and new project, But how can I fix it? I've done searches on stackoverflow and Google but I could not solve my problem
Thanks in advance

You should do two things:
Change the package route for your component because you may are having a conflict with other component of AppCompat 7
Don't copy the jar. Import your project as a Android Project. It is: in the target project, where you want to use your component, add your library project from:
Right Click on project> Properties > Android > Add project (below Check project as Library, that should be unchecked).
If you have imported your library project, it should appear there.
Good luck buddy!

Related

SDK integration in android

I have added Facebook SDK and Google-play-services_lib as library in my project . I have deleted android-support-v4.jar from my project Lib folder. Now I am facing with following problem
[2014-09-26 15:47:47 - Dex Loader] Unable to execute dex: Multiple DEX files define Lcom/facebook/android/AsyncFacebookRunner$1;
[2014-09-26 15:47:47 - Mmatching] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/facebook/android/AsyncFacebookRunner$1;
This means that you have multiple files defined for your project settings.
For that,
Go to the,
Project Properties -> Java build path -> Libraries -> Remove Android dependencies
To be more specific -
Just removing the facebook-android-sdk.jar file from libs worked for me as well as it refers to the facebook related jar which I had in multiple.
Remove this error by following these steps:
Right click on the project and open the properties.
Go to 'Java Build Path..'
Go to Order & Export tab. Unmark 'Android Private Libraries' & Click 'OK'.
and clean your project. It works.
Just Uncheck your Android Dependencies checkbox from Java Build Path -> Order and Export.

Project Contains Error but not showing in source code Android

I import a pre-developed project in eclipse,in starting it shows me many errors.
After importing and including all the necessary files there are no error showing in my source code.
But whenever i tried to run the application it alert me that " There is error in my project".
But no errors are showing inside my project.
How can i fix my problem ?
This is what showing in my console in red color.
[2014-02-12 16:05:53 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/readystatesoftware/sqliteasset/SQLiteAssetException; [2014-02-12 16:05:53 - AClickCell_Orion] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/readystatesoftware/sqliteasset/SQLiteAssetException;
Go to lib folder and remove or delete android-support-v4 jar file. And clean and run. It will work.
Go to Project Properties > Java Build Path and under Add Libraries Tab, remove Android Dependencies. Then right click on project, go to Android Tools and click Add supported Libraries. See if that helps
Your project has two copies of the sqliteasset helper library. Remove one of them.

DX Error when running Android Studio project

I am trying to set up my Android Studio project with al its dependencies. But when i try to run my project i get the following error messages:
Android Dex: [AndroidVI] Unable to execute DX
Android Dex: [AndroidVI] com.android.dx.util.DexException: Multiple dex files define Lcom/androidquery/util/Constants;
Can anybody help me with this
Check Whether You added Same jar files more than once.
If yes,Remove any one of them from libs folder and clean your project.
Check if Your Proguard is running or not.

java.lang.NoClassDefFoundError when trying to run tasks-android-sample

I have been trying to run the sample code available at http://samples.google-api-java-client.googlecode.com/hg/tasks-android-sample/instructions.html
I have included all jar file needed to resolve the dependencies. My project doesn't contain any error but when i try to the program it give me following error:
java.lang.NoClassDefFoundError:
com.google.api.client.googleapis.auth.oauth2.GoogleCredential
I can see that the above class file is present in my reference libraries still the code is not running. Trying to solve this from 2 days. Please help
I think you should drop these jars in a folder named /libs at the root of your project. See this SO question: How can I use external JARs in an Android project?
Have you included your libs in the java build path and checked it in the Order and Export Tab?
i.e
Project > Properties > Java Build Path > Order and Export > and finally, checkmark your imported library.

Adding a Android Library from a project into the workspace generate a Android Dependencies.Eclipse

When I select the properties to my project then go to Android and add a new Library, the eclipse automatically create a Android Depencies that contains all my .jars.
It does not add the new project to the list of referenced packages. When I try to Run the application I got the error: Conversion to Dalvik format failed with error 1. When i realize I have the .jars that i added both in the Android Dependencies and my /gen.
When I delete de Android Depencies I got error in my classes, saying that i´m not referencing the specifics .jar... But I have them in my /gen past.
Any Ideia how to make the eclipse refer to just one .jar?
Library is a special android feature that allows you to use an apk or another android project where you would for example share some code. It's detailed here :
http://developer.android.com/guide/developing/projects/projects-eclipse.html
I think that what you want to achieve is just adding a jar as a dependency which can be done with Project > Properties > Java Build Path > Libraries Tabs > Add Jars / Add External Jars.
tl;dr :
Project > Properties > Java Build Path > Libraries != Project > Properties > Android > Library
I did these steps to make my app work with the lib-sources using adt 17
add "lib-sources-project" to workspace
import/general/existingProjectsIntoWorkspace
mark this "lib-sources-project" as android library
lib/Properties/Android/IsLibrary must be checked
Add lib to main app
app/buildpath/ConfigureBuildPath/Projects Add "lib-sources-project"
app/buildpath/ConfigureBuildPath/OrderAndExport set check for "lib-sources-project" so your lib will be included into the buildresult
app/Properties/Android/Library Add "lib-sources-project" to the list.
Note since adt 17 you can have resources in your "lib-sources-project". Android Lint will tell you what you have to change to make it work.
Hoever i haven't succeeded yet to include a jar with resources without adding "lib-sources-project" as described above.
Maybe somebode knows how to do this.

Categories

Resources