3

I am building an Adobe Native extension (ANE) which has third party JAR dependencies. I am making sure that the third party class files are extracted and packaged inside the ANE JAR (as explained in this answer)

But when I build the final android APK for my application, these classes are missing in the classes.dex. It seems that ADT is stripping them out somehow. It is worth mentioning that the third party JAR that I am using is built with Java 1.7 and I am using Java 1.6.

SNce
  • 2,453
  • 1
  • 16
  • 14
  • Well without much to go on, I'm going to suggest you try compiling your ANE against the same version of java as the JAR your trying to use. Seems like an obvious first step – CyanAngel Jul 16 '14 at 09:44
  • That is not an option for me right now. The project is quite big and has some dependencies on Java 1.6. For now I am using the dex2jar(https://code.google.com/p/dex2jar/) tool to manually inject the needed classes into the final APK and re-sign it. However it would be nice if I don't have to do this as I would like to have the luxury of debugging inside IntelliJ Idea 13. – SNce Jul 16 '14 at 09:50
  • What does Java 1.6 have that 1.7 doesn't? – CyanAngel Jul 16 '14 at 09:51
  • Long and short of this is. It's impossible for us to know whats missing from the 1.7 JAR your trying to add, since you haven't even given us a link to it. My course of action right now would be to grab the source code of the 1.7 JAR, put it in an IDE like Eclipse, using the 1.6 JDK, see what classes are missing, add them in, recompile the JAR. You cant get around the fact that the classes are missing and your going to have to add them some how. – CyanAngel Jul 16 '14 at 09:56
  • Well it is not about what 1.7 has over 1.6 but it would mean updating Java on our CI machines, rebuilding artifacts on our maven repository. It is a lot of effort for the little time that we have. – SNce Jul 16 '14 at 09:58
  • Then it's impossible to answer your question without it being some variation of "Add the missing classes somehow". But you already know that and are doing it. – CyanAngel Jul 16 '14 at 10:00
  • Yep! :(, I was doing that till now, but I have reached a point where I have to try to do it the right way. Unfortunately I cannot post any source as it is proprietary. Thanks for your comments. :) – SNce Jul 16 '14 at 10:04
  • If you have access to the source, put in an IDE as I suggested, that way at-least your not having to inject the relevant classes with a third party application – CyanAngel Jul 16 '14 at 10:06
  • I don't have sources to add the third-party library to my project. The other option for me is to create a post build step to inject the needed classes in the IDE build, like I am doing in the CI. – SNce Jul 16 '14 at 10:10
  • possible duplicate of [AIR 3 Native Extensions for Android - Can I/How to include 3rd party libraries?](http://stackoverflow.com/questions/7732742/air-3-native-extensions-for-android-can-i-how-to-include-3rd-party-libraries) – Brian Jul 16 '14 at 22:18
  • This is a well-known issue - see http://stackoverflow.com/questions/9085189/how-to-add-third-party-jar-files-into-my-android-application-jar-file and http://stackoverflow.com/questions/7732742/air-3-native-extensions-for-android-can-i-how-to-include-3rd-party-libraries as well as https://forums.adobe.com/message/4806229. – Brian Jul 16 '14 at 22:19

1 Answers1

6

Not sure if this is the most ideal thing to do but I solved this by replacing the dx.jar in $FLEX_AIR_SDK_HOME/lib/android/bin/dx.jar with the one in Android build tools version 20. This dx tool was not stripping out classes with java major version 51.

SNce
  • 2,453
  • 1
  • 16
  • 14