Pergunta

I am using code (not written by me) with dependencies on GSON libraries. I have downloaded the libraries and when I try to include them in the project I get a duplication error. Specifically:

Error generating final archive: Found duplicate file for APK: assembly-descriptor.xml

Here's a screenshot of the error:

I don't have a lot of experience with using external libraries. Can anyone help me out?

Thanks in advance.

Foi útil?

Solução

I had the same problem, the solution found out to be rather simple though. Just choose one of the libraries - either gson-1.6-sources or gson-1.6 to be added to your path and bravely delete another one from there.

It caused me quite lot of trouble, not only with error, you've mentioned but also with NoClassDefFoundError for Gson class within my Activity code.

P.S. I would appreciate any clarification, why this duplication error actually happens:).

Outras dicas

I had the same problem too.

I assume you have done what I did - got the gson jars (compiled and source) and put them both into the 'libs' directory in your project?

From what I understand now, the android ant target looks for libraries to build into the APK from the libs directory, hence it will get duplicates because you have the compiled library and the source version in the 'libs' directory.

My solution was to have a second directory 'libs-src' into which I moved the source jars. Then the ant target doesn't pick those source jars up and the build works.

See if you already have it and delete it, after: Project > Properties > Java Build Path > Libraries > Add External Jars… and add the GSON libraries.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top