How to add a flurry to an Android studio project?

How can I add flurry to my Android studio project, I have not done this before, so I'm not quite sure where to add the files? I have FlurryAnalytics.jar

and how to use in my application?

thanks

+7
android flurry
source share
1 answer

This is how I added Flurry:

  • Add FlurryAnalytics_3.3.2.jar (or the last one) to the libs folder (create this directory if necessary)

    • Add compile fileTree(dir: 'libs', include: '*.jar') depending on the build.gradle project

      dependencies {compile fileTree (dir: 'libs', include: '* .jar')}

  • or Gradle + Jcenter compile 'com.flurry.android:analytics:6.2.0'

  • Add the appropriate permissions for AndroidManifest.xml:

     <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
  • Make sure that the versionName attribute is specified in AndroidManifest.xml to have the data specified under this name, for example:

     <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0"> 
  • If necessary, add the Flurry API key to the constant file, for example, AppConstants.java:

     public class AppConstants { public static final String FLURRY_API_KEY = "YOUR_API_KEY"; // where YOUR_API_KEY is your actual API key from FLURRY similar to 1ABCDE23EFGH4IJKLMN5O 
  • Add Flurry onStartSession and onEndSession to each action in your application:

     @Override protected void onStart() { super.onStart(); FlurryAgent.onStartSession(this, AppConstants.FLURRY_API_KEY); } @Override protected void onStop() { super.onStop(); FlurryAgent.onEndSession(this); } 

I still had some problems at the moment and chose the hint recommended by Android Studio when viewing the build.gradle file. He changed gradle -1.8-bin.zip to gradle -1.8-bin.zip to gradle -1.8-all.zip in gradle / wrapper / gradle -wrapper.properties:

 distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-all.zip 

After that, my project worked successfully and started logging Flurry events. FYI, it takes hours to see the magazines in Flurry.

This is a good link for Android Studio and gradle.

And, of course, Flurry is provided with details for most of this as well.

+9
source share

All Articles