简体   繁体   中英

Android Flurry Events

I have gone through the tutorial and did exactly what it said. I gave INTERNET,COARSE_LOCATION,FINE_LOCATION permissions. Added jar file in the libraries. It's not working. App is getting crashed at FlurryAgent.onStartSession() . This is the code that I am using as given by them:

@Override
    protected void onStart() {
        super.onStart();
        FlurryAgent.onStartSession(MainActivity.this, MY_KEY);//MY_KEY is key given by them.
    }
    @Override
    protected void onStop() {
        super.onStop();
        FlurryAgent.onEndSession(this);
    }

Here is the stack trace:

08-28 16:52:49.499: E/AndroidRuntime(18639): FATAL EXCEPTION: main
08-28 16:52:49.499: E/AndroidRuntime(18639): java.lang.NoClassDefFoundError: com.flurry.android.FlurryAgent
08-28 16:52:49.499: E/AndroidRuntime(18639):    at com.example.test.MainActivity.onStart(MainActivity.java:31)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1166)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.app.Activity.performStart(Activity.java:3842)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1719)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1765)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.app.ActivityThread.access$1500(ActivityThread.java:158)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:996)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.os.Handler.dispatchMessage(Handler.java:130)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.os.Looper.loop(SourceFile:351)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at android.app.ActivityThread.main(ActivityThread.java:3850)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at java.lang.reflect.Method.invokeNative(Native Method)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at java.lang.reflect.Method.invoke(Method.java:538)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
08-28 16:52:49.499: E/AndroidRuntime(18639):    at dalvik.system.NativeStart.main(Native Method)

Well it obviously cannot find the com.flurry.android.FlurryAgent class. Check if the JAR contains such class. If not, it's the wrong JAR. If it does, you didn't include the JAR in your build path correctly.

Keep in mind that to do automatic adding to the build path you have to add it in the libs/ directory (and not lib/ ). IIRC this has changed recently with the Android SDK update. Anyway I suggest you adding it manually to the build path to make sure.

Don't forget to clean and rebuild when done.

It obviously crashes at runtime, you may check that your jar is exported when building apk: in project Properties > Java Build Path, go to the 'Order and Export' folder and fill the checkbox corresponding to your jar. And rebuild.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM