How to add third-party jar files into my android application jar file?
Asked Answered
D

3

1

I have an Adobe AIR application for Android. Using for this AIR 3.0 and Flash Builder 4.6. I need to make MyANEFile.ane - which must include 2 external .jar files: Flurry.jar + Tapjoy.jar. But when I made .ane file - it does not work. How can I add this 2 jar files to my main application jar file to make .ane file properly? Thanks.

It shows me such errors in dalvik:

*01-31 21:37:37.046: I/dalvikvm(12983): Could not find method com.amobee.agency.tracking.AmobeeReceiver.amobeeTracking, referenced from method com.mycompany.extensions.AmobeeInitAmobeeTrackingFunction.call

01-31 21:37:37.046: W/dalvikvm(12983): VFY: unable to resolve static method 317: Lcom/amobee/agency/tracking/AmobeeReceiver;.amobeeTracking (Ljava/lang/String;Landroid/content/Context;Ljava/lang/String;)V*

Dunlap answered 31/1, 2012 at 18:54 Comment(0)
D
3

Suppose your main extension jar file is extension.jar and you are using code in external.jar. Then you can put the classes from external.jar into extension.jar using the Java jar tool:

jar -xf external.jar

This will extract the .class files into package folders. If the top-level package is "com", then you can add those to extension.jar with:

jar -uf extension.jar com

(Repeat the second command for each top-level package in the external jar.)

Dunlap answered 2/2, 2012 at 19:38 Comment(0)
F
2

If you are using Eclipse to develop, right click on the project and go to:

Properties -> Java Build Path -> Libraries -> Add External JARs

Foamflower answered 31/1, 2012 at 19:58 Comment(1)
Thanks, but it does not help(. Still can't find methods in external jar classes.Dunlap
J
1

I was having issue with creating an Android ANE for AdMobs and this is what worked for me.

Do like Flynn suggested and add the jar in the Java Build Path:

Eclipse Java Build Path showing GoogleAdMobsAdsSdk jar in the build path

Then, the only way I could get the AdMobs jar to play nice in the ANE was to export the Android native jar for the ANE with Export... -> Java -> JAR File and have both "Export all output folders for checked projects" and "Export Java source files and resources" checked:

Eclipse JAR Export with "Export all output folders for checked projects" and "Export Java source files and resources" selected

Jeweljeweler answered 13/3, 2013 at 4:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.