Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to implement Instabug (crash analytics) into my android flutter app, and I'm confused as to where I should input this code into my project.

Initialize Instabug in the onCreate() method of your Application subclass:

Image of the step from instabug

Where is the onCreate() method for the Application subclass in a flutter package? And if I need to create one, where would I make it?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
4.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

In the flutter app root,

Follow android/app/src/main/kotlin/your package/, then you'll see MainActivity.

Just create a class which is inherits from FlutterApplication in same path of MainActivity

class CustomApplication : FlutterApplication {
    override fun onCreate() {
        super.onCreate()
        // Paste here the integration codes of instabug
    }
}

Then go to Manifest, android/app/src/main/kotlin/your package/AndroidManifest.xml, and modify application section

<application
   android:name=".CustomApplication"
   ...
</application>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...