I have an app I created using Flutter / Dart / VSCode / Android Studio and wanted to work on it with Visual Studio App Center.
I add an Android app using Java / Kotlin, then add
dependencies { def appCenterSdkVersion = '3.2.2' implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" }
to app/build.gradle but that's about as far as I get before messing up.
I don't know what 'my app's main class activity' is, I'm guessing it's not main.dart as when I put the following code in there I get errors.
import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.analytics.Analytics;
import com.microsoft.appcenter.crashes.Crashes;
I also can't find onCreate anywhere (other than AndroidManifest.xml where it's commented out).
I've looked through Getting started with the Android SDK, but can't figure it out.
Can anyone help me out?
I'm pretty much at the end of my tether so any help would be greatly appreciated!
UPDATE
build.gradle
dependencies {
def appCenterSdkVersion = '3.2.2'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
}
MainActivity.kt
import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.analytics.Analytics;
import com.microsoft.appcenter.crashes.Crashes;
AndroidManifest.xml
<!-- 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. -->
AppCenter.start(getApplication(), "{My App Secret}",
Analytics.class, Crashes.class);