0

I've been trying for the past few days to make a Java library work with an Android app. The library is called WooCommerce API Java Wrapper and it's open-source. The problem is that I'm getting a compile time error which is the following: Return code 1 for dex process.

I have already searched on Google, Stackoverflow and many other sites for help with no luck. I've tried everything from changing Java version and adding Jack support (mentioned in the Github issue with the link below) to enabling multidex.

I've already tried getting help from the developer but he doesn't have any experience with Android app development. And from my side, I don't have any knowledge on how Java/Android libraries work.

I opened an issue on the Github repository of the library itself: https://github.com/icoderman/wc-api-java/issues/10

Please keep in mind that I'm still a beginner in Android development itself. Any help is greatly appreciated.

Toufic Batache
  • 762
  • 10
  • 24
  • Are you compiling from the command line or within an IDE? – user2768 Apr 12 '18 at 16:08
  • I'm using IntelliJ IDEA. That's an example project: https://github.com/icoderman/wc-api-java/files/1881794/MyApplication.zip – Toufic Batache Apr 12 '18 at 16:09
  • I don't know that one particularly well, are you compiling in debug or release mode? – user2768 Apr 12 '18 at 16:10
  • Debug mode. But I've already tried release mode, with no luck. Any experience with Android Studio? It's the same as IntelliJ – Toufic Batache Apr 12 '18 at 16:11
  • You'll need to post more details of the compile time error. Can you construct a minimal example that doesn't compile? – user2768 Apr 12 '18 at 16:18
  • Yes, the example app is in the zip link I posted earlier: https://github.com/icoderman/wc-api-java/files/1881794/MyApplication.zip – Toufic Batache Apr 12 '18 at 16:20
  • I can't post the whole compile time error here as it's too long but you can see it at https://github.com/icoderman/wc-api-java/issues/10#issuecomment-378404341 – Toufic Batache Apr 12 '18 at 16:41
  • 2
    `Android compliant java code libraries` and `plain java code libraries` are *two different things*. Even though they speak the same language (Java) and are packaged in the same way (zipped jar's) they have a different *culture* (and don't necessarily understand each other). You cannot include **ANY** plain java code libraries into android and *expect* them to work. With effort (sometimes **MUCH** effort) you can. Sometimes they are are compatible with nothing to be done. see [this](https://www.quora.com/Are-there-major-differences-between-programming-in-Android-vs-plain-Java) – Jon Goodwin Apr 12 '18 at 17:35
  • Oh, that's very interesting to know. Any ideas if some settings can make plain Java work with Android? – Toufic Batache Apr 12 '18 at 17:42
  • 1
    As you say you are a *beginner,* no `settings` can help you, it's all problem, fix, problem, fix, problem, fix, all the way down....(try to include only *android compliant* java *libs* to avoid much pain...What you can safely import is a main problem, amongst all the other ones. Oracle java is up to version 10 now, but you can only use 8 (max) with android as I speak.(error 52 is classic `your using a lower version` than is required) Good luck! (jack and jill outdated, update your IDE) Update your JDK(jdk1.8.0_152 ) and JRE (>=1.44) !, UPDATE !!! IDE 3.1.1, classpath 3.1, gradle 3.44. – Jon Goodwin Apr 12 '18 at 21:42
  • Thanks Jon for your help! I'll try my best – Toufic Batache Apr 13 '18 at 03:46
  • Hey Jon, I see you edited your comment multiple times. What should I update to make it work? I have jdk1.8.0_121, jre1.8.0_121, IntelliJ IDEA 2018.1, gradle-4.4 – Toufic Batache Apr 15 '18 at 13:47

0 Answers0