简体   繁体   中英

Error in Flurry Android analytics

I am trying to integrate flurry android integration tool to my app. I have integrated the jar library but I'm stuck at this point as I'm getting some error. Error says Cannot resolve method 'onCreate()' and Cannot resolve symbol 'XY**********P2P'

 import com.flurry.android.FlurryAgent;
    import com.getbase.floatingactionbutton.FloatingActionButton;


    public class MainActivity extends Activity {


        @Override
        public void onCreate() {
            super.onCreate();
            // init Flurry
            FlurryAgent.init(this, XYB***********2P);
            //....
        }

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

The first error is due to the @Override annotation on top of your first onCreate method. onCreate is a method of your superclass, Activity , and is defined like your second onCreate method, it needs to be protected and take a Bundle object as argument, otherwise it doesn't override the superclass method. To fix this, simply delete your first onCreate method and move the code you need to the second one.

The second error is due to the fact that you haven no variable with the name XYB***********2P so the compiler doesn't know what to do with that.

Since the init method of FlurryAgent (see docs) takes a String, you could define one like so :

private final static String FLURRY_KEY = "XYB***********2P";

then use it like this :

FlurryAgent.init(this, FLURRY_KEY);

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