Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate entry error #21

Closed
ExCx opened this issue Jan 18, 2018 · 9 comments
Closed

Duplicate entry error #21

ExCx opened this issue Jan 18, 2018 · 9 comments

Comments

@ExCx
Copy link

ExCx commented Jan 18, 2018

Hi, I added your library to my gradle and when I try to build my project it threw this error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/xmlbeans/xml/stream/Location.class

I found it here that this issue is related to POI having same class names with javax or something like that.

Your last commit is pretty new though. I guess it's my mistake but I cannot find a solution, and I didn't see it mentioned anywhere in this repository.

@ozlerhakan
Copy link
Owner

Hi @ExCx ,

I haven't known that issue before. Have you tried to remove the duplicate classes in the corresponding jar file followed by creating a new jar?

@ExCx
Copy link
Author

ExCx commented Jan 18, 2018

Hmm, no. It seemed a little bit complicated to me, so I didn't even try.

As you see, in that SO link they suggested this repackaged version to overcome this issue: https://github.com/andruhon/android5xlsx

So I tried to add that library instead and my project is built without problems.

Now, I can work with that library too. But your sample codes seem much more practical for my situation. That lib don't seem have a direct solution like "xlsx->java object" which I absolutely need.

@ozlerhakan
Copy link
Owner

well, let's see how I can help you with the problem.

I can give a try to eliminate duplicated classes from the jar but we must prepared ourselves for any obscure results. if you share with me a simple POC project that gives that error is a good starting point, I think.

@ExCx
Copy link
Author

ExCx commented Jan 19, 2018

Ok, now I tried to build a clean project and found the problem. It's because I need to use Java 1.8 compatibility. Set the target and source compatibility in module settings or place this into the gradle file and you'll see:

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

@ozlerhakan
Copy link
Owner

so it works now right?

@ExCx
Copy link
Author

ExCx commented Jan 19, 2018

It works without the compatibility mode alright. But if anyone wants to use the new features of Java 8 in Android Studio 3, he/she will face the same problem for sure.

For me, it's not urgent really. I only used Java 8 for lambda expressions to shorten my code. So, I changed some lines here and there to their Java 7 versions and it works now.

I believe, sooner or later you have to look into it, though.

Anyway, thanks for this beautiful library. I'll get in contact if I find any more issues.

@ozlerhakan
Copy link
Owner

ozlerhakan commented Jan 19, 2018

I believe, sooner or later you have to look into it, though.

I keep in my mind the problem.

Anyway, thanks for this beautiful library. I'll get in contact if I find any more issues.

Thank you @ExCx :) and please do so when you have it

@JDSCaram
Copy link

JDSCaram commented May 9, 2018

Any solution for using Java 8?

  compileOptions {
      targetCompatibility JavaVersion.VERSION_1_8
      sourceCompatibility JavaVersion.VERSION_1_8
  }

Without the Java 8, it is works normally

@ozlerhakan
Copy link
Owner

we can open it up until we receive any other issue with this

@ozlerhakan ozlerhakan unpinned this issue May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants