Skip to main content
Inspiring
December 28, 2012
Answered

Flurry Agent Crashing App - Android Native Extension

  • December 28, 2012
  • 3 replies
  • 2853 views

I am creating an Android Native Extension for my game. I need to be able to access a 3rd party sdk (for which I have the source files) that was written in java.

The sdk uses Flurry Analytics for recording events and it is integrated into the sdk source code.

I have managed to get a working ane that can communicate back and forth between my game and the java sdk, however, when the sdk tries to initialize it's reporting class, the app "initialization" method that is executing terminates prematurely. It doesn't crash the app, and no exceptions are reported in the code, but since the method terminates prematurely, all the initialization code that follows doesn't get run, thus blowing up the entire sdk.

In the Android Debug Monitor LogCat I get the following output when the reporting class is created:

12-28 15:05:26.488: I/dalvikvm(1776): Could not find method com.flurry.android.FlurryAgent.onEndSession, referenced from method com.bigfishgames.bfglib.bfgReporting.destroy
12-28 15:05:26.488: W/dalvikvm(1776): VFY: unable to resolve static method 1973: Lcom/flurry/android/FlurryAgent;.onEndSession (Landroid/content/Context;)V
12-28 15:05:26.488: D/dalvikvm(1776): VFY: replacing opcode 0x71 at 0x0011
12-28 15:05:26.488: D/dalvikvm(1776): VFY: dead code 0x0014-0016 in Lcom/bigfishgames/bfglib/bfgReporting;.destroy ()V
12-28 15:05:26.488: I/dalvikvm(1776): Could not find method com.flurry.android.FlurryAgent.onStartSession, referenced from method com.bigfishgames.bfglib.bfgReporting.sharedInstance
12-28 15:05:26.488: W/dalvikvm(1776): VFY: unable to resolve static method 1975: Lcom/flurry/android/FlurryAgent;.onStartSession (Landroid/content/Context;Ljava/lang/String;)V
12-28 15:05:26.488: D/dalvikvm(1776): VFY: replacing opcode 0x71 at 0x0067
12-28 15:05:26.488: I/dalvikvm(1776): Could not find method com.flurry.android.FlurryAgent.onError, referenced from method com.bigfishgames.bfglib.bfgReporting._logError
12-28 15:05:26.488: W/dalvikvm(1776): VFY: unable to resolve static method 1974: Lcom/flurry/android/FlurryAgent;.onError (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
12-28 15:05:26.488: D/dalvikvm(1776): VFY: replacing opcode 0x71 at 0x0004
12-28 15:05:26.488: D/dalvikvm(1776): VFY: dead code 0x0007-0007 in Lcom/bigfishgames/bfglib/bfgReporting;._logError (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
12-28 15:05:26.488: I/dalvikvm(1776): Could not find method com.flurry.android.FlurryAgent.onError, referenced from method com.bigfishgames.bfglib.bfgReporting._logError
12-28 15:05:26.488: W/dalvikvm(1776): VFY: unable to resolve static method 1974: Lcom/flurry/android/FlurryAgent;.onError (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
12-28 15:05:26.488: D/dalvikvm(1776): VFY: replacing opcode 0x71 at 0x0000
12-28 15:05:26.488: D/dalvikvm(1776): VFY: dead code 0x0003-0003 in Lcom/bigfishgames/bfglib/bfgReporting;._logError (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
12-28 15:05:26.488: I/dalvikvm(1776): Could not find method com.flurry.android.FlurryAgent.logEvent, referenced from method com.bigfishgames.bfglib.bfgReporting.logEvent
12-28 15:05:26.488: W/dalvikvm(1776): VFY: unable to resolve static method 1971: Lcom/flurry/android/FlurryAgent;.logEvent (Ljava/lang/String;)V
12-28 15:05:26.488: D/dalvikvm(1776): VFY: replacing opcode 0x71 at 0x0000
12-28 15:05:26.488: D/dalvikvm(1776): VFY: dead code 0x0003-0003 in Lcom/bigfishgames/bfglib/bfgReporting;.logEvent (Ljava/lang/String;)V
12-28 15:05:26.488: I/dalvikvm(1776): Could not find method com.flurry.android.FlurryAgent.logEvent, referenced from method com.bigfishgames.bfglib.bfgReporting.logEvent
12-28 15:05:26.488: W/dalvikvm(1776): VFY: unable to resolve static method 1972: Lcom/flurry/android/FlurryAgent;.logEvent (Ljava/lang/String;Ljava/util/Map;)V
12-28 15:05:26.488: D/dalvikvm(1776): VFY: replacing opcode 0x71 at 0x0000
12-28 15:05:26.488: D/dalvikvm(1776): VFY: dead code 0x0003-0003 in Lcom/bigfishgames/bfglib/bfgReporting;.logEvent (Ljava/lang/String;Ljava/util/Map;)V

Then when the sdk source executes FlurryAgent.onStartSession, the java code stops executing and kicks all the way back out to the action script code.

I have done some reading and the only thing I found similiar was this:

Check the project properties Java build path then the order and export tab make sure the FlurryAgent.jar is selected.

In my project, I have the FlurryAgent.jar added as an external jar in the libraries, and in the order and export, it is at the top of the list, just under the FlashRuntimeExtension.jar and it is checked.

To create my ane jar file, I am right clicking on the project, selecting export, I then select Java/JAR file.

Export generated class files and resources is checked

compress the contents of the jar file is checked

add directory entries is checked

and all files and folders in my project are checked.

I opened the final .jar file in winrar and the FlurryAgent.jar file is libs folder along with the FlashRuntimeExtensions.jar

Does anyone know what I am doing wrong, or not including in the file apk (like some dependency I don't know about)?

I am using Eclipse for Mobile Developers Version: Juno Service Release 1 Build id: 20121004-1855 as my Java IDE for building the native extension jar file on Windows 7

I am building the ANE using Air 3.5.0.840

Using Flash Builder 4.6 to build the apk

Testing on a Sony Ericsson Xpeira Phone running Android 2.3.4

This topic has been closed for replies.
Correct answer Mark_Jawdoszak1

You need to extract the .class files from the External JAR and then insert them into your ANEs target JAR.

Within the Java JDK's BIN directory, you'll find "jar.exe".

You need to run:

jar -xf external.jar (or whatever the flurry jar is called)


This will extract the .class files in a folder format, with the top-level most directory (probaly "com") in the same directory as the external.jar.

Now you need to run:

jar -uf yourJar.jar com

This will include all of the classes, recursively, into "yourJar.jar" so that they can be used within your extension.

3 replies

Mark_Jawdoszak1Correct answer
Participant
January 9, 2013

You need to extract the .class files from the External JAR and then insert them into your ANEs target JAR.

Within the Java JDK's BIN directory, you'll find "jar.exe".

You need to run:

jar -xf external.jar (or whatever the flurry jar is called)


This will extract the .class files in a folder format, with the top-level most directory (probaly "com") in the same directory as the external.jar.

Now you need to run:

jar -uf yourJar.jar com

This will include all of the classes, recursively, into "yourJar.jar" so that they can be used within your extension.

Inspiring
January 9, 2013

I am not using jar to create my final jar, but the ecplise export function. But if I rename the file .jar to a .zip and add them, then it works the same.

Thanks.

Participant
January 10, 2013

I do the same :-)

Once I've Exported my jar, then I run the functions I mentioned above.  But yes, renaming as a .zip would work fine, as the jar is just a renamed container.