Closed rahulraorefyne closed 1 year ago
@rahulraorefyne Can you tell which WebEngage_flutter version you are using and on which platform (iOS or Android) you are getting this error. our latest plugin is 1.2.0
yes its true we mack MainApplication class like this:
`import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterFragmentActivity
import com.webengage.sdk.android.WebEngageActivityLifeCycleCallbacks; import io.flutter.app.FlutterApplication; import com.webengage.webengage_plugin.WebengageInitializer; import com.webengage.sdk.android.WebEngageConfig; import com.webengage.sdk.android.WebEngage; import com.webengage.sdk.android.WebEngageActivityLifeCycleCallbacks; import com.webengage.sdk.android.LocationTrackingStrategy;
class MainApplication : FlutterApplication() { fun onCreate() { super.onCreate() val webEngageConfig = WebEngageConfig.Builder() .setWebEngageKey("~key") .setAutoGCMRegistrationFlag(false) .setLocationTrackingStrategy(LocationTrackingStrategy.ACCURACY_BEST) .setDebugMode(true) // only in development mode .build() WebengageInitializer.initialize(this, webEngageConfig) } }`
and get this errors:
`e: /Users/mahanabedini/AndroidStudioProjects/doki-app-new26/android/app/src/main/kotlin/es/mhholding/doki_app/MainApplication.kt: (6, 34): Conflicting import, imported name 'WebEngageActivityLifeCycleCallbacks' is ambiguous e: /Users/mahanabedini/AndroidStudioProjects/doki-app-new26/android/app/src/main/kotlin/es/mhholding/doki_app/MainApplication.kt: (11, 34): Conflicting import, imported name 'WebEngageActivityLifeCycleCallbacks' is ambiguous e: /Users/mahanabedini/AndroidStudioProjects/doki-app-new26/android/app/src/main/kotlin/es/mhholding/doki_app/MainApplication.kt: (15, 9): 'onCreate' hides member of supertype 'FlutterApplication' and needs 'override' modifier
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction Compilation error. See log for more details
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 16s Exception: Gradle task assembleDebug failed with exit code 1`
i used like document: https://docs.webengage.com/docs/flutter
@mahanabd As per the log , there were multiple import of same file - WebEngageActivityLifeCycleCallbacks. just remove the one import line 9 and add a override annotation before fun onCreate()
import com.webengage.sdk.android.WebEngageActivityLifeCycleCallbacks;
the above code will look like the below one
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.app.FlutterApplication;
import com.webengage.webengage_plugin.WebengageInitializer;
import com.webengage.sdk.android.WebEngageConfig;
import com.webengage.sdk.android.WebEngage;
import com.webengage.sdk.android.WebEngageActivityLifeCycleCallbacks;
import com.webengage.sdk.android.LocationTrackingStrategy;
class MainApplication : FlutterApplication() {
override fun onCreate() {
super.onCreate()
val webEngageConfig = WebEngageConfig.Builder()
.setWebEngageKey("YOUR_LICENCSE_CODE")
.setAutoGCMRegistrationFlag(false)
.setLocationTrackingStrategy(LocationTrackingStrategy.ACCURACY_BEST)
.setDebugMode(true) // only in development mode
.build()
WebengageInitializer.initialize(this, webEngageConfig)
}
}
We will also update our docs for the same . If you have any queries then you can reach out to us on support@webengage.com.
@MilindWebEngage oh sorry for this issue
MissingPluginException(No implementation found for method trackEvent on channel webengage_flutter)
WebEngage throws this exception: