简体   繁体   English

创建pdf文件android时出错

[英]Error in creating a pdf file android

I am new to Android programming,my task was to create a pdf file in adroid 我是Android编程的新手,我的任务是在adroid中创建一个pdf文件

First I created a Java project using Eclipse (projectA) , wrote code in java to generate a pdf file using itext (Added jars to the project) and its working fine. 首先,我使用Eclipse(projectA)创建了一个Java项目,在java中编写了代码,使用itext生成了一个pdf文件(为项目添加了jar)并且工作正常。

Now I created another Android project (ProjectB) , and added the itext jars (similar to projectA) and code, but it is not working properly 现在我创建了另一个Android项目(ProjectB),并添加了itext jars(类似于projectA)和代码,但它无法正常工作

Error : Error generating final archive: Found duplicate file for APK: com/itextpdf/text/LICENSE.txt
Origin 1: /home/SudheerB/workspace-Ecclipse/NeedAnalyserTool13/libs/itextpdf-5.3.3-sources.jar
Origin 2: /home/SudheerB/workspace-Ecclipse/NeedAnalyserTool13/libs/itext-xtra-5.3.3-sources.jar

Can someone help me on this? 有人可以帮我吗?

It is very simple. 这很简单。 You are using jar files which have some common classes. 您正在使用具有一些常见类的jar文件。 so during the generation of apk file, duplicates files are being found. 所以在生成apk文件时,正在找到重复文件。

just use one of the jar files. 只需使用其中一个jar文件。 either "itextpdf.jar" or "itextpdf-xtra.jar". “itextpdf.jar”或“itextpdf-xtra.jar”。 your problem will be solved. 你的问题将得到解决。

从项目中删除源jar,至少该错误应该消失。

Seems like you're using the jars that are available for Java instead of the Android/GAE port. 好像你正在使用可用于Java的jar而不是Android / GAE端口。 Please switch to using the official port for Android and Google App Engine. 请切换到使用Android和Google App Engine的官方端口。 That will solve your problem. 这将解决您的问题。 This port isn't available from SourceForge, you need to fill out the form at http://itextpdf.com/sales/ and they'll send you a link where you can download it. SourceForge不提供此端口,您需要填写http://itextpdf.com/sales/上的表单,他们会向您发送一个可以下载的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM