Problems integrating an SDK into flutter app

144 views Asked by At

I'm trying to implement Instabug (crash analytics) into my android flutter app.

I've tried installing from https://pub.dev/packages/instabug_flutter, and I'm not sure as to where I should be putting the new CustomFlutterApplication class.

this is my code

package io.flutter.plugins;

import java.util.ArrayList;


public class CustomFlutterApplication extends FlutterApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        ArrayList<String> invocation_events = new ArrayList<>();
        invocation_events.add(InstabugFlutterPlugin.INVOCATION_EVENT_FLOATING_BUTTON);
        InstabugFlutterPlugin instabug = new InstabugFlutterPlugin();
        instabug.start(CustomFlutterApplication.this, "2d355f559ea67051a56fce82603f8e41", invocation_events);
        instabug.setWelcomeMessageMode("WelcomeMessageMode.disabled");
    }
}

PATH: app/src/main/java/io/flutter/plugins/CustomFlutterApplication.java

I've also renamed the android:name line of code in the androidManifest.xml file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ju.test_app_v2">
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name=".CustomFlutterApplication"
        android:label="test_app_v2"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">

PATH: app/src/main/AndroidManifest.xml

This is the main error that I am getting, and I think I might have to import something else so that FlutterApplication can be recognized? Im not sure

/Users/juliaju/AndroidStudioProjects/test_app_v2/android/app/src/main/java/io/flutter/plugins/CustomFlutterApplication.java:6: error: cannot find symbol
public class CustomFlutterApplication extends FlutterApplication {
                                              ^
  symbol: class FlutterApplication
/Users/juliaju/AndroidStudioProjects/test_app_v2/android/app/src/main/java/io/flutter/plugins/CustomFlutterApplication.java:7: error: method does not override or implement a method from a supertype
    @Override
1

There are 1 answers

0
Shehab Ibrahim On

Try importing InstabugFlutterPlugin:

import com.instabug.instabugflutter.InstabugFlutterPlugin;

Check the Flutter Docs for more details