问题
I am trying to create pdf files in android using itext library. But whenever i run the project, I am getting the following error.
Error:Failed to resolve: com.itextpdf:itextpdf:4.2.2
I have entered the following dependencies in my gradle.
compile 'com.lowagie:itext:4.2.2'
compile 'com.itextpdf:itextg:5.5.9'
Can someone please help in this. I have searched a lot on internet but have found nothing.
回答1:
When you want to create an Android application, you need to use iTextG, so this is correct:
compile 'com.itextpdf:itextg:5.5.9'
However, you are also importing a rogue version of iText that doesn't work on Android:
compile 'com.lowagie:itext:4.2.2'
You need to remove that dependency.
Please compare the package name with my name: Lowagie. I am the original developer of iText, and because of the fact that so many people contacted (or even harassed me) personally with questions about iText, I changed the package names from com.lowagie
to com.itextpdf
in 2009. That's almost 8 years ago.
If you see my name in your code, then you are doing something wrong. Replace all import com.lowagie
instances with import com.itextpdf
because I removed my name from the packaged names 8 years ago.
来源:https://stackoverflow.com/questions/44160828/errorfailed-to-resolve-com-itextpdfitextpdf4-2-2