Question

Im new to Android development and im trying to integrate Flurry Analytics into a blank project. I have added the jar file as an external jar to the build path.

This is my MainActivity:

package com.example.myfirstapp;

import android.app.Activity; import android.os.Bundle; import android.view.Menu;

import com.flurry.android.FlurryAgent;

public class MainActivity extends Activity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    protected void onStart()
    {
        super.onStart();
        FlurryAgent.onStartSession(this, "YOUR_API_KEY");
    }

    @Override
    protected void onStop()
    {
        super.onStop();     
        FlurryAgent.onEndSession(this);
    }


     }

and this is my App Manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfirstapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="18" />

        <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.myfirstapp.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.myfirstapp.DisplayMessageActivity"
            android:label="@string/title_activity_display_message"
            android:parentActivityName="com.example.myfirstapp.MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.myfirstapp.MainActivity" />
        </activity>
    </application>

</manifest>

obviously I have entered my api key but the app stops in the emulator. This is the log errors:

02-11 15:20:12.433: I/dalvikvm(1307): Could not find method com.flurry.android.FlurryAgent.onStartSession, referenced from method com.example.myfirstapp.MainActivity.onStart
02-11 15:20:12.433: W/dalvikvm(1307): VFY: unable to resolve static method 5059: Lcom/flurry/android/FlurryAgent;.onStartSession (Landroid/content/Context;Ljava/lang/String;)V
02-11 15:20:12.433: D/dalvikvm(1307): VFY: replacing opcode 0x71 at 0x0005
02-11 15:20:12.443: I/dalvikvm(1307): Could not find method com.flurry.android.FlurryAgent.onEndSession, referenced from method com.example.myfirstapp.MainActivity.onStop
02-11 15:20:12.443: W/dalvikvm(1307): VFY: unable to resolve static method 5058: Lcom/flurry/android/FlurryAgent;.onEndSession (Landroid/content/Context;)V
02-11 15:20:12.443: D/dalvikvm(1307): VFY: replacing opcode 0x71 at 0x0003
02-11 15:20:13.133: D/AndroidRuntime(1307): Shutting down VM
02-11 15:20:13.133: W/dalvikvm(1307): threadid=1: thread exiting with uncaught exception (group=0xb3ac2ba8)
02-11 15:20:13.143: E/AndroidRuntime(1307): FATAL EXCEPTION: main
02-11 15:20:13.143: E/AndroidRuntime(1307): Process: com.example.myfirstapp, PID: 1307
02-11 15:20:13.143: E/AndroidRuntime(1307): java.lang.NoClassDefFoundError: com.flurry.android.FlurryAgent
02-11 15:20:13.143: E/AndroidRuntime(1307):     at com.example.myfirstapp.MainActivity.onStart(MainActivity.java:30)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.app.Activity.performStart(Activity.java:5241)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.os.Handler.dispatchMessage(Handler.java:102)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.os.Looper.loop(Looper.java:136)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at android.app.ActivityThread.main(ActivityThread.java:5017)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at java.lang.reflect.Method.invokeNative(Native Method)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at java.lang.reflect.Method.invoke(Method.java:515)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
02-11 15:20:13.143: E/AndroidRuntime(1307):     at dalvik.system.NativeStart.main(Native Method)
02-11 15:20:36.633: I/Process(1307): Sending signal. PID: 1307 SIG: 9

Thanks

Was it helpful?

Solution

One thing to note is that flurry take a while to update their online stats. I was using a fresh new android app which had the above problems.... but the original app was working fine, just hadn't waited long enough for the stats to update

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top