GithubHelp home page GithubHelp logo

amplitude / amplitude-flutter Goto Github PK

View Code? Open in Web Editor NEW
109.0 15.0 62.0 727 KB

Official Amplitude Flutter SDK

Home Page: https://developers.amplitude.com/docs/flutter-setup

License: MIT License

Kotlin 23.44% Ruby 2.25% Swift 14.22% Objective-C 0.47% Dart 50.55% HTML 6.63% JavaScript 2.45%
flutter dart amplitude amplitude-analytics sdk

amplitude-flutter's Introduction


pub package

Official Amplitude Flutter SDK

This is the official Amplitude Flutter SDK developed and maintained by Amplitude Inc.

Installation and Quick Start

  • Please visit our 💯Developer Center for instructions on installing and using our the SDK.
  • For developing the SDK, please visit our CONTRIBUTING.md to get started.

Compatibility

From Amplitude Flutter v3.11.0, we bump up the kotlin version to v1.7.10 to support latest Gradle. For Gradle Version lower than v6.7.1, we recommend to use the Amplitude Flutter v3.10.0. The following matrix lists the minimum support for Amplitude Flutter SDK version.

Amplitude Flutter Gradle Android Gradle Plugin Kotlin Gradle Plugin
3.11.+ 6.7.1 3.6.4 1.7.10

Learn more about the Android Gradle Plugin compatibility, Gradle compatibility, and Kotlin compatibility.

Need Help?

If you have any problems or issues over our SDK, feel free to create a github issue or submit a request on Amplitude Help.

amplitude-flutter's People

Contributors

amplitude-sdk-bot avatar bradchien avatar danielvestergaard avatar dantetam avatar falconandy avatar haoliu-amp avatar incendial avatar jeroenbogersphilips avatar jooohhn avatar jtothebell avatar justin-fiedler avatar keke-dandois avatar marco4763 avatar matyushenko13 avatar nilsreichardt avatar nishiths23 avatar ogustavobelociandt avatar qingzhuozhen avatar reeichert avatar sergey-triputsco avatar spkersten avatar vishna avatar yuhao900914 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amplitude-flutter's Issues

com.amplitude.api.AmplitudeClient: context cannot be null, set context with initialize() before calling logEvent()

Expected Behavior

logEvent() should be worked correctly

Current Behavior

Got exception after logEvent() function

Possible Solution

According to the log, set context correctly in amplitude sdk can fix this issue.

Steps to Reproduce

Build apk with flutter 1.22.4 and invoke logEvent by amplitude.dart.

Environment

  • SDK Version: 2.2.3
  • Flutter Version: 1.22.4
  • Device: Pixel 3
  • Device OS and Version: Android 11

Past data updated todays without any forced customizing

My team just figure out that past data can updated in spite of days ago.
When we service web page with amplitude javascript previously, this case does not happened.
So, my company asking for why this situation happening.
And we've got answered like this; ' This is flutter issue. In flutter library, event fullfil with 30 events then it goes to server. '

I think this can be a little bit critical issue.
I guess, according to that answer, we cannot see whole data with amplitude because if someone's events are less than 30, then we can't get any events with that customer.

So, I wish that amplitude flutter library enhanced as soon as possible.

Always thanks to your service :D

iOS crashes with no trace when .setUserId(null) is called.

Hi! Awesome library btw. Helps my startup stay legal, lol.

Please note, that this code crashes only on iOS, not Android.

This is the relevant code:

  AmplitudeService({
    @required this.apiKey,
    @required this.userLocale,
    @required this.resolvedLocale,
    @required this.optOut,
  }) {
    _client = Amplitude.getInstance(instanceName: 'turnip');
    _client.init(apiKey);
    _client.enableCoppaControl();
    _client.trackingSessionEvents(true);
    _client.setOptOut(optOut);
  }

  void setToken(Token token) {
    if (token == null) {
       _client.setUserId(
        null,
        startNewSession: true,
      );
    } else {
      // set user id
      final userId = token?.userId;
      _client.setUserId(userId);

      final userRole = token?.userRole;
      final subsCategory = token?.subscriptionCategory;

      _client.setUserProperties({
        'userRole': userRole,
        'subscriptionCategory': subsCategory,
      });
    }
  }

Here in void setToken, if token == null, _client.setUserId crashes the whole app and leaves no trace. The same thing happens even if I do not specify startNewSession: true.

If I comment out the _client.setUserId(null). Everything works as expected.

To be honest this is not the end of the world and does not dilute the data too much. But it would be handy to be able to "sign out" a user and be able to there and then start a new session.

Am I doing it wrong perhaps?

Upgrade kotlin_version to 1.3.40 and higher

Expected Behavior

Current Behavior

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher.
The following dependencies do not satisfy the required version:
project ':amplitude_flutter' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21

Steps to Reproduce

Add plugin to project and start it

Environment

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.1 20G80 darwin-arm, locale en-RU)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
[✓] VS Code (version 1.60.1)
[✓] Connected device (2 available)

  • Device: all Android
  • Device OS and Version: all Android

setUserId not work on iOS

setUserId not work on iOS

Environment

Flutter (Channel stable, 1.22.4, on macOS 11.1 20C69 darwin-x64, locale es-419)
• Flutter version 1.22.4
• Framework revision 1aafb3a8b9 (8 weeks ago), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4

IOS Compile error

Expected Behavior

IOS compile error

Current Behavior

IOS compile error.

Possible Solution

Steps to Reproduce

  1. amplitude_flutter: ^2.0.0
  2. flutter pub get
  3. Run

스크린샷 2020-12-11 오후 5 38 32

Environment

  • SDK Version: Amplitude (7.2.0)
  • Flutter Version: 1.22.5
  • Device: any iOS device
  • Device OS and Version: any iOS device

How do I log idfa and google ad id?

How do I report idfa or google ad id through this SDK?

I already have both reliably setup (we're using adjust as well) and available as String - but I don't know how to pass them to amplitude.

flutter build apk terminates while build appbundle works as intended

Building plugin amplitude_flutter...
Running Gradle task 'assembleAarRelease'...
               
Running Gradle task 'assembleAarRelease'... Done
        2,780ms


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'amplitude_flutter'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* 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 2s


The plugin amplitude_flutter could not be built due to
the issue above.
 What went wrong:
A problem occurred configuring root project 'amplitude_flutter'.

Expected Behavior

Should build apk

Current Behavior

Error got thrown

Steps to Reproduce

  1. add dependency
  2. run flutter build apk

Environment

  • SDK Version: 3.1.0
  • Flutter Version: 2.0.5

Deprecated API usage in iOS

Expected Behavior

Build should complete without any errors from Amplitude.

Current Behavior

[01:00:37]: ▸ Generating 'Amplitude.framework.dSYM'
[01:00:37]: ▸ Touching Amplitude.framework (in target 'Amplitude' from project 'Pods')
[01:00:37]: ▸ Processing amplitude_flutter-Info.plist
[01:00:37]: ▸ Copying amplitude_flutter-umbrella.h
[01:00:37]: ▸ Copying AmplitudeFlutterPlugin.h
[01:00:37]: ▸ Compiling SwiftAmplitudeFlutterPlugin.swift
[01:00:38]: ▸ ⚠️  /Users/pal/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/SwiftAmplitudeFlutterPlugin.swift:127:64: 'logRevenue(_:quantity:price:)' is deprecated: Use `logRevenueV2` and `AMPRevenue` instead
[01:00:38]: ▸                     Amplitude.instance(withName: instanceName).logRevenue(productIdentifier,
[01:00:38]: ▸                                                                ^
[01:00:38]: ▸ ⚠️  /Users/pal/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/SwiftAmplitudeFlutterPlugin.swift:134:64: 'logRevenue' is deprecated: Use `logRevenueV2` and `AMPRevenue` instead
[01:00:38]: ▸                     Amplitude.instance(withName: instanceName).logRevenue(NSNumber(value: amount))
[01:00:38]: ▸                                                                ^
[01:00:38]: ▸ Compiling SwiftAmplitudeFlutterPlugin.swift
[01:00:38]: ▸ ⚠️  /Users/pal/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/SwiftAmplitudeFlutterPlugin.swift:127:64: 'logRevenue(_:quantity:price:)' is deprecated: Use `logRevenueV2` and `AMPRevenue` instead
[01:00:38]: ▸                     Amplitude.instance(withName: instanceName).logRevenue(productIdentifier,
[01:00:38]: ▸                                                                ^
[01:00:38]: ▸ ⚠️  /Users/pal/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/SwiftAmplitudeFlutterPlugin.swift:134:64: 'logRevenue' is deprecated: Use `logRevenueV2` and `AMPRevenue` instead
[01:00:38]: ▸                     Amplitude.instance(withName: instanceName).logRevenue(NSNumber(value: amount))
[01:00:38]: ▸                                                                ^

Possible Solution

Stop using deprecated API and use the recommended APIs intead.

Steps to Reproduce

  1. Depend on amplitude_flutter: ^3.7.0
  2. Build and watch logs, I saw this while using fastlane: bundle exec fastlane beta

Environment

[✓] Flutter (Channel master, 2.10.0-1.0.pre.344, on macOS 12.2 21D49 darwin-arm, locale en-SE)
    • Flutter version 2.10.0-1.0.pre.344 at /Users/pal/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6f079010b4 (5 hours ago), 2022-01-31 14:32:18 -0500
    • Engine revision 48ae905cb1
    • Dart version 2.17.0 (build 2.17.0-67.0.dev)
    • DevTools version 2.10.0-dev.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/pal/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.32.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 12.2 21D49 darwin-arm
    • Chrome (web)    • chrome • web-javascript • Google Chrome 97.0.4692.99

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Only few of the events get synced to the amplitude dashboard

we have the app which has lots of event. only the events on the home page are getting reported accurately. if the user starts navigating to other screens the event start getting missed even though it is being called accurately. there is no exception related to any thing in the code. plus we have tried to run it in debug mode set to catch all exceptions and there is none.

Expected Behavior

All of the event should be reported perfectly fine.

Current Behavior

some events don't get reported. they don't follow any specific pattern. sometime it keeps on reporting way past few screen sometimes it stops no concentrate way to reproduce that..

Possible Solution

is there a way to turn the dubgging on for the sdk?? to check what's exactly going on there??

Steps to Reproduce

just start the app
navigate back and forth few screens then event will eventually be stopped and you will not see any thing on dashboard.
sometime it keeps on going and only certain events doesn't get sent.
the specific even we are consistently having issue with is "join call" event.

Environment

  • SDK Version: ^3.8.1
  • Flutter Version: 2.10.2
  • Device: Poco X3, oneplus, emulator almost all of the devices
  • Device OS and Version: android 11, android 12.

Android sessions not being reported the same as iOS sessions.

Expected Behavior

When I set up the SDK according to the documentation then the start of a user's session should be reported the same for iOS and Android.

Current Behavior

iOS will report when a session starts/ends but android does not.

Possible Solution

The only solution I have found is to call analytics.logEvent() to get data showing up for android.

Steps to Reproduce

  1. Create a project from the amplitude flutter example app
  2. In the my_app.dart file change the initState() to match the getting started guide.
  @override
  void initState() {
    super.initState();

    analytics = Amplitude.getInstance();
    analytics.init(widget.apiKey);
    analytics.setUserId("test_user");
    analytics.trackingSessionEvents(true);
  }
  1. Running this for iOS will send data to the web interface
  2. Running this for android will NOT send data to the web interface

Environment

  • SDK Version: v3.2.1
  • Flutter v2.2.2
  • Device: iPhone 11Pro Simulator, Pixel 2
  • Device OS and Version: iOS 14.5, Android 11

Linux Support

I develop my app for Android, iOS, Windows, macOS and Linux.
It would be great if you provide support for Linux.

Build error on iOS during pod install

Expected Behavior

Project build with no errors.

Current Behavior

When building for iOS, I'm getting this error:

Running pod install...
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `amplitude_flutter` from `.symlinks/plugins/amplitude_flutter/ios`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: all_pods_versions_f_4_d.txt exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: Specs/f/4/d/Amplitude/8.4.0/Amplitude.podspec.json exists! Returning local because checking is only performed in repo update
    [!] CocoaPods could not find compatible versions for pod "Amplitude":
      In Podfile:
        amplitude_flutter (from `.symlinks/plugins/amplitude_flutter/ios`) was resolved to 0.0.1, which depends on
          Amplitude (= 8.5.0)

    None of your spec sources contain a spec satisfying the dependency: `Amplitude (= 8.5.0)`.

    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
     * mistyped the name or version.
     * not added the source repo that hosts the Podspec to your Podfile.

    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `tap'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:257:in `process_topmost_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:416:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:161:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update

Error running pod install
Error launching application on iPhone 13.

Steps to Reproduce

  1. Create any fresh flutter project.
  2. Add platform :ios, '10.0' to your Podfile.
  3. Add amplitude_flutter: 3.8.0 to pubspec.yaml file.
  4. Run on iOS simulator.

Worth mentioning that it is even failing on the provided example on the repo.

Environment

  • Dart SDK Version: 2.14.3
  • Flutter Version: 2.5.2
  • Device: iPhone 13 simulator
  • Device OS and Version: iOS 15

Expose setOffline

Summary

Expose setOffline via the flutter plugin

Both objective-c and Kotlin counterparts offer a method 'setOffline'.

/**
     * Sets offline. If offline is true, then the SDK will not upload events to Amplitude servers;
     * however, it will still log events.
     *
     * @param offline whether or not the SDK should be offline
     * @return the AmplitudeClient
     */
    public AmplitudeClient setOffline(boolean offline) {
        this.offline = offline;

        // Try to update to the server once offline mode is disabled.
        if (!offline) {
            uploadEvents();
        }

        return this;
    } 
- (void)setOffline:(BOOL)offline {
    _offline = offline;

    if (!_offline) {
        [self uploadEvents];
    }
}

Motivations

Prevent uploading events to Amplitude server in special conditions.

java.lang.NoSuchMethodError: No static method userAgent ()

Current Behavior

The error occurs:
java.lang. NoSuchMethodError: Nostaticmethod user Agent()Ljava/Lang/String; in classLokhttp3
Occurs at the initialization stage of the plugin, when the init() method is called, after that the application crashes.

Possible Solution

It is the result of incompatibility of the versions of okhttp3 in different plugins/ libraries of the project, since many other libraries use the version of the okhttp API 3.12.+.
To solve the problem, you need to build from the build file.gradle should remove an explicit reference to the version of okhttp3 4.2.2, since these different versions of the okhttp3 API are not compatible in the same project.

Environment

  • SDK Version:
  • Flutter Version:
  • Device:
  • Device OS and Version:

Add null safety

Summary

Flutter now supports null safety in the stable channel. Please migrate this package to null safety. You can use the dart migrate tool.

Motivations

Android build fail (after upgrade flutter 2.10.3)

on iOS it's work but on Android I have this error during the build:

  • What went wrong:
    Execution failed for task ':amplitude_flutter:compileDebugKotlin'.

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 17s
Running Gradle task 'assembleDevDebug'... 18.4s

┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update │
│ /Users/imsangcheol/Working/TripleComma/dev/goldspoon-app/android/build.gradle: │
│ ext.kotlin_version = '' │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘
Gradle task assembleDevDebug failed with exit code 1

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.1 21C52 darwin-arm, locale ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.65.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

Environment

  • SDK Version: amplitude_flutter: ^3.8.1

User Properties values is empty - how fix it?

I use amplitude for my flutter project. I need values City, Country, Region, Device... I disabled CoppaControl:

await _analytics.disableCoppaControl();

but my User Properties is empty:

image

Fields "last seen" is updated, but I cannot see the values for any of the fields.

image

how do i fix it?

error from OkHttp with Amplitude init() from android app

Steps to Reproduce

  1. use flutter command to create a new project
  2. try to init amplitude
  void initState() {
    super.initState();
    final amplitude =
        Amplitude.getInstance(instanceName: 'INSTANCE_NAME');

    amplitude.init('MY_API_KEY');
  }
  1. run the app on android and there are error messages from OkHttp
W/.amplitude_tes(17596): Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setUseSessionTickets(Z)V (greylist-max-q,core-platform-api, reflection, denied)
W/OkHttp  (17596): unable to load android socket classes
W/OkHttp  (17596): java.lang.NoSuchMethodException: com.android.org.conscrypt.OpenSSLSocketImpl.setUseSessionTickets [boolean]
W/OkHttp  (17596): 	at java.lang.Class.getMethod(Class.java:2072)
W/OkHttp  (17596): 	at java.lang.Class.getDeclaredMethod(Class.java:2050)
W/OkHttp  (17596): 	at okhttp3.internal.platform.android.AndroidSocketAdapter.<init>(AndroidSocketAdapter.kt:34)
W/OkHttp  (17596): 	at okhttp3.internal.platform.android.StandardAndroidSocketAdapter.<init>(StandardAndroidSocketAdapter.kt:31)
W/OkHttp  (17596): 	at okhttp3.internal.platform.android.StandardAndroidSocketAdapter$Companion.buildIfSupported(StandardAndroidSocketAdapter.kt:57)
W/OkHttp  (17596): 	at okhttp3.internal.platform.android.StandardAndroidSocketAdapter$Companion.buildIfSupported$default(StandardAndroidSocketAdapter.kt:50)
W/OkHttp  (17596): 	at okhttp3.internal.platform.AndroidPlatform.<init>(AndroidPlatform.kt:44)
W/OkHttp  (17596): 	at okhttp3.internal.platform.AndroidPlatform$Companion.buildIfSupported(AndroidPlatform.kt:239)
W/OkHttp  (17596): 	at okhttp3.internal.platform.Platform$Companion.findPlatform(Platform.kt:211)
W/OkHttp  (17596): 	at okhttp3.internal.platform.Platform$Companion.access$findPlatform(Platform.kt:179)
W/OkHttp  (17596): 	at okhttp3.internal.platform.Platform.<clinit>(Platform.kt:180)
W/OkHttp  (17596): 	at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:219)
W/OkHttp  (17596): 	at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:211)
W/OkHttp  (17596): 	at com.amplitude.api.AmplitudeClient.lambda$initialize$0$AmplitudeClient(AmplitudeClient.java:287)
W/OkHttp  (17596): 	at com.amplitude.api.-$$Lambda$AmplitudeClient$9NDt_YKBCJ8Ih0Ic4HFC4DZmSRA.run(Unknown Source:8)
W/OkHttp  (17596): 	at android.os.Handler.handleCallback(Handler.java:938)
W/OkHttp  (17596): 	at android.os.Handler.dispatchMessage(Handler.java:99)
W/OkHttp  (17596): 	at android.os.Looper.loop(Looper.java:223)

Environment

SDK Version: v3.2.1
Flutter v2.2.1

not sure is here the right place to ask, but seems amplitude functionality is working properly, just wonder is there a way to avoid this error message?

Adjust + Amplitude broken on Android

Expected Behavior

[adjust] Install is displayed on Android & iOS

Current Behavior

[adjust] Install is only displayed on iOS

Possible Solution

The root of the problem is Android Amplitude SDK, logs show:

W/com.amplitude.api.DeviceInfo( 3416): Google Play Services not available for advertising id
W/com.amplitude.api.DeviceInfo( 3416): Google Play Services SDK not found for app set id!

Seems like class com.google.android.gms.ads.identifier.AdvertisingIdClient is not getting found in DeviceInfo.java

Followed all the instructions regarding the gradle/proguard setup.

Someone suggested a fix (not using reflection), but afaik it got dismissed dantetam/Amplitude-Android@39c70ab due to "we would have to change our tests" 🤷‍♀️

Now Adjust SDK seems to find and assign advertising id on Android just fine. My fix introduces option to set custom advertising id, this involves changes in both Android and Flutter repos:

Then I can simply use it at initialisation time and supply valid advertising id:

final amplitude = Amplitude.getInstance();
final adId = await Adjust.getGoogleAdId();
await amplitude.setCustomAdvertisingId(advertisingId);

This fixed problem we saw in our amplitude dashboard.

Steps to Reproduce

  1. Integrate Flutter Amplitude SDK
  2. Integrate Flutter Adjust SDK
  3. Publish your apps
  4. Observe Adjust install events are reported on iOS while not reported on Android

Environment

  • SDK Version: 3.8.1
  • Flutter Version: 2.10 stable
  • Device: any Android
  • Device OS and Version: any Android

Implements Amplitude with flutter_segment package

We are trying to implement this package for segment and amplitude integration all at the flutter level.
https://pub.dev/packages/flutter_segment
https://pub.dev/packages/flutter_segment#setting-the-options-globally

The flutter_segment package to identify the user asks me for a session_id but when trying to get this session_id with the amplitude package it always returns -1.

My question is, what would be the best practice to integrate these two packages, maybe there is any suggestion?

As far as I understand I need to identify the user to get a session Id, maybe it works in a similar way with the anonimus id that segment provides?

Windows Support

I develop my app for Android, iOS, Windows, macOS and Linux.
It would be great if you provide support for Windows.

PlatformException(error, TypeError: Cannot read properties of undefined (reading 'getInstance'), null, null)

Expected Behavior

Amplitude should get initialized on Web

Current Behavior

I get an error instead when I run the code on the web but it works on mobile
PlatformException(error, TypeError: Cannot read properties of undefined (reading 'getInstance'), null, null)

Possible Solution

Steps to Reproduce

  1. Add amplitude ^3.8.0 to flutter project
  2. Try initializing amplitude with the following code
Amplitude amplitude = Amplitude.getInstance();
amplitude.init(Config.amplitudeAppId);

Environment

  • SDK Version: ^3.8.0
  • Flutter Version: 2.5.1
  • Device: Chrome
  • Device OS and Version: Web, Chrome Version 96.0.4664.55 on Mac

Pod install fail

Hello, amplitude_flutter 2.0 doesn't work on ios :

 pod install    
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Amplitude":
  In Podfile:
    amplitude_flutter (from `.symlinks/plugins/amplitude_flutter/ios`) was resolved to 0.0.1, which depends on
      Amplitude (= 5.1.0)

Specs satisfying the `Amplitude (= 5.1.0)` dependency were found, but they required a higher minimum deployment target.
"pod deintegrate"
"pod install"
"pod update"

doesn't work ! Any idea ?

Thx for your time

Unable to see event on Amplitude

Hi, I'm using Amplitude on 2.0.0 version and I'm trying to log an event to my dashboard, but unsuccessful, I'd like your help.

import 'package:adam/app_config.dart';
import 'package:amplitude_flutter/amplitude.dart';

class AppAnalytics extends Amplitude {
  static final AppAnalytics _analytics = AppAnalytics._internal();

  AppAnalytics._internal() : super('MyCompany');

  factory AppAnalytics() => _analytics;

  static Future<void> start() async {
    await _analytics.init(AppConfig.instance.analyticsKey);
  }

  static void initTrackWithUserId(String userId, {String screenName}) {
    _analytics
      ..setUserId(userId)
      ..trackingSessionEvents(true)
      ..logEvent('acessed_$screenName');
  }

  static void sendEvent(String event, {Map<String, dynamic> props}) {
    _analytics.logEvent(event, eventProperties: props);
  }
}

I've built this Singleton class and I'm starting at main.dart calling start() above.

I have some previous events that are logging but I'm trying to add new ones but they don't show up at Amplitude for me and I don't know what else to do, besides that, I have some questions.

What is the instanceName? It's the my project's name on Amplitude? My workspace name? Or can it be any name as I wish?

Using as a singleton is doing fine with some old events, but new ones, don't.

Am I missing something? Does the singleton is a good way to keep going?

amplitude_flutter/amplitude_flutter-Swift.h' file not found

Xcode's output:

Writing result bundle at path:
/var/folders/wk/smm6mfxn6dd6rcv8vjtj49qr0000gn/T/flutter_tools.K1r3vy/flutter_ios_build_temp_diruJpgfh/temporary_xcresult_bundle

/Users/vitul/Documents/Software/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.8.1/ios/Classes/AmplitudeFlutterPlugin.m:2:9: fatal error: 'amplitude_flutter/amplitude_flutter-Swift.h' file not found
#import <amplitude_flutter/amplitude_flutter-Swift.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel

Result bundle written to path:
	/var/folders/wk/smm6mfxn6dd6rcv8vjtj49qr0000gn/T/flutter_tools.K1r3vy/flutter_ios_build_temp_diruJpgfh/temporary_xcresult_bundle

App crashing on calling setUserProperties

It's me again, I'm trying to calling setUserProperties but the app, at least on simulator, keep crashing.

class AnalyticsRepositoryImpl implements AnalyticsRepository {
  final Amplitude analytic = Amplitude.getInstance(instanceName: 'Vitta');

  @override
  Future<void> setUserProps(Map<String, dynamic> props) async {
    await analytic.setUserProperties(props);
  }
}

I'm missing something? Again?

Cocoa pods error preventing build

Hello,
Since the current stable release of Flutter the following error is happening:

Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Amplitude":
  In snapshot (Podfile.lock):
    Amplitude (= 5.1.0)

  In Podfile:
    amplitude_flutter (from `.symlinks/plugins/amplitude_flutter/ios`) was resolved to 0.0.1, which depends on
      Amplitude (= 5.2.1)


You have either:
 * changed the constraints of dependency `Amplitude` inside your development pod `amplitude_flutter`.
   You should run `pod update Amplitude` to apply changes you've made.

Could you help me?

Include setMinTimeBetweenSessionsMillis API

Summary

The API setMinTimeBetweenSessionsMillis should be exposed to the Flutter SDK.

Motivations

By adding this support the Flutter SDK would be more in line with the native support. The Flutter SDK should include all functionality of the native SDK. Unofficial forks of the Amplitude Flutter SDK will lead to increased fragmentation of the ecosystem. Please consider adding this soon.

minSdkVersion 16 is incorrect

Your android plugin defines minSdkVersion 16. However, you include dependency on com.squareup.okhttp3:okhttp:4.2.2 which supports only Android 21+. Running on device with Android api 16 ends up with java.lang.NoClassDefFoundError: java.util.Objects exception as Objects class is not present in the OS.

Crash on iOS

Expected Behavior

App should not crash

Current Behavior

App is crashing

Possible Solution

userId is passed to the parameters map instead of startNewSession

Steps to Reproduce

  1. call method setUserId with startNewSession true
  2. app crash is observed on iOS

Environment

  • SDK Version: 2.2.1
  • Flutter Version: 1.22.2
  • Device: any iOS device
  • Device OS and Version: any iOS device

Build for iOS fails when Bitcode is enabled

After regenerating the Podfile file using rm ios/Podfile, and trying to build, the build fails. This was done because the tool itself suggested it (maybe some changes to that file in latest Flutter versions).

Running pod install...                                              5,3s
Warning: Podfile is out of date
  This can cause issues if your application depends on plugins that do not
  support iOS.
  See
  https://flutter.dev/docs/development/packages-and-plugins/developing-packages#
  plugin-platforms for details.
  If you have local Podfile edits you would like to keep, see
  https://github.com/flutter/flutter/issues/45197 for instructions.
To regenerate the Podfile, run:
  rm ios/Podfile



Running Xcode build...

This is the related error log:

ld:
    '/Users/cristianzazo/<elided>/build/ios/Release-iphoneos/Amplitude/Amplitu
    de.framework/Amplitude' does not contain bitcode. You must rebuild it with
    bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library
    from the vendor, or disable bitcode for this target. file
    '/Users/cristianzazo/<elided>/build/ios/Release-iphoneos/Amplitude/Amplitu
    de.framework/Amplitude' for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see
    invocation)
    ld:
    '/Users/cristianzazo/<elided>/build/ios/Release-iphoneos/Amplitude/Amplitu
    de.framework/Amplitude' does not contain bitcode. You must rebuild it with
    bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library
    from the vendor, or disable bitcode for this target. file
    '/Users/cristianzazo/<elided>/build/ios/Release-iphoneos/Amplitude/Amplitu
    de.framework/Amplitude' for architecture arm64
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
[✓] Flutter (Channel master, 1.20.0-1.0.pre.132, on Mac OS X 10.15.5 19F101,
    locale es-ES)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)

Android error during build / iOS work: Execution failed for task ':amplitude_flutter:compileDebugKotlin'.

Hello

I want to remove Segment to use directly amplitude for track event analytics.
So I follow step by step the guideline to add amplitude-flutter

on iOS it's work but on Android I have this error during the build:

'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15. [ ] The class is loaded from /Users/yelkamel/.gradle/caches/transforms-2/files-2.1/69cffba187c9174af5a287de98f1cddd/jetified-kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class [ ] e: /Users/yelkamel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.5.0/android/src/main/kotlin/com/amplitude/amplitude_flutter/AmplitudeFlutterPlugin.kt: (196, 24): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15. [ +6 ms] The class is loaded from /Users/yelkamel/.gradle/caches/transforms-2/files-2.1/69cffba187c9174af5a287de98f1cddd/jetified-kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class [ ] e: /Users/yelkamel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.5.0/android/src/main/kotlin/com/amplitude/amplitude_flutter/AmplitudeFlutterPlugin.kt: (200, 24): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15. [ ] The class is loaded from /Users/yelkamel/.gradle/caches/transforms-2/files-2.1/69cffba187c9174af5a287de98f1cddd/jetified-kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class [ ] e: /Users/yelkamel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.5.0/android/src/main/kotlin/com/amplitude/amplitude_flutter/AmplitudeFlutterPlugin.kt: (202, 24): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15. [ ] The class is loaded from /Users/yelkamel/.gradle/caches/transforms-2/files-2.1/69cffba187c9174af5a287de98f1cddd/jetified-kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class [ ] e: /Users/yelkamel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.5.0/android/src/main/kotlin/com/amplitude/amplitude_flutter/AmplitudeFlutterPlugin.kt: (209, 24): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15. [ ] The class is loaded from /Users/yelkamel/.gradle/caches/transforms-2/files-2.1/69cffba187c9174af5a287de98f1cddd/jetified-kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class [ ] e: /Users/yelkamel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.5.0/android/src/main/kotlin/com/amplitude/amplitude_flutter/AmplitudeFlutterPlugin.kt: (215, 24): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15. [ ] The class is loaded from /Users/yelkamel/.gradle/caches/transforms-2/files-2.1/69cffba187c9174af5a287de98f1cddd/jetified-kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class [ ] e: /Users/yelkamel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.5.0/android/src/main/kotlin/com/amplitude/amplitude_flutter/AmplitudeFlutterPlugin.kt: (218, 24): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15. [ ] The class is loaded from /Users/yelkamel/.gradle/caches/transforms-2/files-2.1/69cffba187c9174af5a287de98f1cddd/jetified-kotlin-stdlib-1.5.30.jar!/kotlin/Unit.class [ ] e: /Users/yelkamel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.5.0/android/src/main/kotlin/com/amplitude/amplitude_flutter/AmplitudeFlutterPlugin.kt: (226, 27): For-loop range must have an 'iterator()' method [ ] e: /Users/yelkamel/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/amplitude_flutter-3.5.0/android/src/main/kotlin/com/amplitude/amplitude_flutter/AmplitudeFlutterPlugin.kt: (228, 25): For-loop range must have an 'iterator()' method [ +145 ms] > Task :amplitude_flutter:compileDebugKotlin FAILED [ +96 ms] FAILURE: Build failed with an exception. [ ] * What went wrong: [ ] Execution failed for task ':amplitude_flutter:compileDebugKotlin'. [ ] > 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 10s [ ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. [ ] Use '--warning-mode all' to show the individual deprecation warnings. [ ] See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings [ ] 9 actionable tasks: 1 executed, 8 up-to-date [ +613 ms] Running Gradle task 'assembleDebug'... (completed in 11.4s) [+2930 ms] Exception: Gradle task assembleDebug failed with exit code 1 [ +10 ms] "flutter run" took 19,348ms. [ +14 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:669:9) <asynchronous suspension> #2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27) <asynchronous suspension> #3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #4 CommandRunner.runCommand (package:args/command_runner.dart:209:13) <asynchronous suspension> #5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9) <asynchronous suspension> #6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5) <asynchronous suspension> #8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9) <asynchronous suspension> #9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #10 main (package:flutter_tools/executable.dart:92:3) <asynchronous suspension>

Environment

  • SDK Version: ">=2.7.0 <3.18.1"
  • Flutter Version: 2.5
  • Device OS and Version: Android 10

Flutter macOS Support

Description

Hi! Our Flutter app Sharezone is available as an Android, iOS, Web and macOS app. We would love to see macOS support ❤️

Plugin registration crashes with NPE

Expected Behavior

Plugin registers without crashes when app runs in background e.g. Service handle some platform Intent and starts headless FlutterEngine that executes

Current Behavior

Amplitude plugin registration crashes:
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:119) at com.amplitude.amplitude_flutter.AmplitudeFlutterPlugin$Companion.registerWith(AmplitudeFlutterPlugin.kt:22) at com.amplitude.amplitude_flutter.AmplitudeFlutterPlugin.registerWith(Unknown Source:2)

Possible Solution

Migrate the plugin to flutter android v2 embedding.

Don't use PluginRegistry.messenger(). According to the docs This registrar is for Flutter's v1 embedding.

Steps to Reproduce

  1. Application uses Android v2 plugin embedding.
<application
        android:name=".Application"
        android:icon="@mipmap/ic_launcher"
        ...>

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
  1. Execute GeneratedPluginRegistrant.registerWith(engine) when an app runs in background e.g. a Service instantiates a FlutterEngine and registers plugins.

Example:

package example

import android.app.IntentService
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugins.GeneratedPluginRegistrant
import io.flutter.view.FlutterCallbackInformation
import io.flutter.view.FlutterMain

class ExampleService : IntentService("Example") {
    private var backgroundChannel: MethodChannel? = null

    private var backgroundFlutterEngine: FlutterEngine? = null

    override fun onCreate() {
        super.onCreate()

        if (backgroundFlutterEngine == null) {

            val callbackHandle = retrieveCallbackHandler(....)
            val callbackInfo = try {
                FlutterCallbackInformation.lookupCallbackInformation(callbackHandle)
            } catch (e: IllegalStateException) {
                null
            }

            if (callbackInfo != null) {
                // Create a FlutterEngine which will process the events.
                backgroundFlutterEngine = FlutterEngine(this.applicationContext)

                GeneratedPluginRegistrant.registerWith((backgroundFlutterEngine!!)

                val args = DartExecutor.DartCallback(this.applicationContext.assets, FlutterMain.findAppBundlePath(this.applicationContext)!!, callbackInfo)
                // Start running callback dispatcher code in our background FlutterEngine instance.
                backgroundFlutterEngine!!.dartExecutor.executeDartCallback(args)

                backgroundChannel = MethodChannel(backgroundFlutterEngine!!.dartExecutor.binaryMessenger, "com.example.callback")
            }
        }

    }

    override fun onDestroy() {
        super.onDestroy()
        backgroundFlutterEngine?.destroy()
    }
}

Environment

  • SDK Version:
  • Flutter Version: 1.22.2
  • Device: any

Error installing

I think very similarly to the issues reported. I have different error messages.

CocoaPods' output:
↳
      Preparing
    Analyzing dependencies
    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    Finding Podfile changes
      A amplitude_flutter
      - Firebase
      - Flutter
      - firebase_messaging
      - google_sign_in
      - google_sign_in_web

...

Error output from CocoaPods:
↳
    [!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

flutter version

Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.5
    19F101, locale en-US)

Flutter project must be Swift compatible?

Hi, how are you?
Is necessary that my project be Swift compatible?
I'm facing the following error, with a brand new project.

- `amplitude_flutter` does not specify a Swift version and none of the targets (`Runner`) integrating it have the
    `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of
    the targets that integrate this pod.

    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/target_validator.rb:125:in
    `verify_swift_pods_swift_version'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/xcode/target_validator.rb:39:in `validate!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:590:in `validate_targets'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:158:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Pricing

Summary

Is Amplitude-Flutter free?

If not then is there any free tier term?

After a fresh install receive classNotFound error on Android

Expected Behavior

I/zygote ( 6749): at okhttp3.internal.platform.android.SocketAdapter okhttp3.internal.platform.android.ConscryptSocketAdapter.buildIfSupported() (ConscryptSocketAdapter.kt:64) I/zygote ( 6749): at void okhttp3.internal.platform.AndroidPlatform.<init>() (AndroidPlatform.kt:45) I/zygote ( 6749): at okhttp3.internal.platform.Platform okhttp3.internal.platform.AndroidPlatform$Companion.buildIfSupported() (AndroidPlatform.kt:239) I/zygote ( 6749): at okhttp3.internal.platform.Platform okhttp3.internal.platform.Platform$Companion.findPlatform() (Platform.kt:211) I/zygote ( 6749): at okhttp3.internal.platform.Platform okhttp3.internal.platform.Platform$Companion.access$findPlatform(okhttp3.internal.platform.Platform$Companion) (Platform.kt:179) I/zygote ( 6749): at void okhttp3.internal.platform.Platform.<clinit>() (Platform.kt:180) I/zygote ( 6749): at void okhttp3.OkHttpClient.<init>(okhttp3.OkHttpClient$Builder) (OkHttpClient.kt:219) I/zygote ( 6749): at void okhttp3.OkHttpClient.<init>() (OkHttpClient.kt:211) I/zygote ( 6749): at void com.amplitude.api.AmplitudeClient.lambda$initialize$0$AmplitudeClient(android.content.Context, java.lang.String, com.amplitude.api.AmplitudeClient) (AmplitudeClient.java:272) I/zygote ( 6749): at void com.amplitude.api.-$$Lambda$AmplitudeClient$9hxT9i3yp7eOymOvTMj42XcPKBs.run() (lambda:-1) I/zygote ( 6749): at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:790) I/zygote ( 6749): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99) I/zygote ( 6749): at void android.os.Looper.loop() (Looper.java:164) I/zygote ( 6749): at void android.os.HandlerThread.run() (HandlerThread.java:65) I/zygote ( 6749): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.conscrypt.ConscryptHostnameVerifier" on path: DexPathList[[zip file "/data/app/**removedpath**/base.apk"],nativeLibraryDirectories=[/data/app/**omitted**/lib/x86, /data/app/**ommited**/base.apk!/lib/x86, /system/lib, /vendor/lib]]

Current Behavior

After a fresh install in a emulator i received this error when i try to use init method

Possible Solution

I couldn't find

Steps to Reproduce

After a fresh install in a emulator i received this error when i try to use init method

Environment

  • SDK Version:
  • Flutter Version: v1.20.1
  • Device: Nexus 5 Emulator
  • Device OS and Version: Android 8.1.0

app crashed in release

This has been fixed in amplitude_flutter 3.4.0. Thanks.

Originally posted by @yuhao900914 in #67 (comment)

After update plugin in debug mode all works fine, but when i build release app crashed with this error

Caused by: android.view.InflateException: Binary XML file line #11 in com.android.chrome:layout/0_resource_name_obfuscated: Error inflating class
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:854)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1231)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1119)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
at android.view.LayoutInflater.inflate(LayoutInflater.java:656)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at ED1.a(chromium-TrichromeChromeGoogle.aab-stable-460606133:3)
at Cl4.b(chromium-TrichromeChromeGoogle.aab-stable-460606133:7)
at jn0.run(chromium-TrichromeChromeGoogle.aab-stable-460606133:4)
at LN.run(chromium-TrichromeChromeGoogle.aab-stable-460606133:10)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:336)
at android.os.Looper.loop(Looper.java:174)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Caused by: java.lang.IllegalArgumentException: ChromeColors requires a value for the com.android.chrome:attr/0_resource_name_obfuscated attribute to be set in your app theme. You can either set the attribute in your theme or update your theme to inherit from Theme.MaterialComponents (or a descendant).
at PQ1.c(chromium-TrichromeChromeGoogle.aab-stable-460606133:5)
at HV.b(chromium-TrichromeChromeGoogle.aab-stable-460606133:3)
at org.chromium.chrome.browser.compositor.CompositorView.g(chromium-TrichromeChromeGoogle.aab-stable-460606133:4)
at org.chromium.chrome.browser.compositor.CompositorView.(chromium-TrichromeChromeGoogle.aab-stable-460606133:5)
at org.chromium.chrome.browser.compositor.CompositorViewHolder.(chromium-TrichromeChromeGoogle.aab-stable-460606133:15)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:854)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:1231)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1119)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
at android.view.LayoutInflater.inflate(LayoutInflater.java:656)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at ED1.a(chromium-TrichromeChromeGoogle.aab-stable-460606133:3)
at Cl4.b(chromium-TrichromeChromeGoogle.aab-stable-460606133:7)
at jn0.run(chromium-TrichromeChromeGoogle.aab-stable-460606133:4)
at LN.run(chromium-TrichromeChromeGoogle.aab-stable-460606133:10)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:336)
at android.os.Looper.loop(Looper.java:174)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2021-10-01 09:18:47.948 13380-13380/? E/ocessService0:: Not starting debugger since process cannot load the jdwp agent.
2021-10-01 09:18:58.459 4461-12883/? E/memtrack: Couldn't load memtrack module
2021-10-01 09:19:31.825 2060-7208/? E/memtrack: Couldn't load memtrack module

when i remove amplitude plugin and build app all works fine

Set useDynamicConfig for China Mainland?

I use amplitude for my flutter project, by checking the reports we found out we can't get any analytics report from Mainland China, by checking the docs I found this:

image

But so far Amplitude-Flutter do not expose this useDynamicConfig configuration.

I try to change the iOS code but still the Amplitude.instance still do not have any useDynamicConfig method/props.

Is there any sulutions?

A user ID that comes from another project is set without calling setUserID

Expected Behavior

The user profile should not show a user ID, only Amplitude ID, as setUserID was not called

Current Behavior

User profile shows a user ID that comes from another project linked to a different app with a different bundle ID. Both projects are inside the same organization

Steps to Reproduce

This issue was only reproducible in iOS for me. I installed the apps from TestFlight.
You need to have two applications linked to two different projects within the same organization in Amplitude.

  • Application A
  • Application B
  1. Install Application A from TestFlight
  2. Call setUserID within application A with ID 12345
  3. Install Application B from TestFlight
  4. Do NOT call setUserId in Application B
  5. Go to Amplitude's console, project linked to Application B: user profile shows ID 12345(the one set in A), but user ID should be empty

If Application A is uninstalled before installing B (between steps 2 and 3), then the issue doesn't happen and everything works fine

Environment

  • SDK Version: 2.2.1
  • Flutter Version: 2.0.3
  • Device: iPhone SE
  • Device OS and Version: iOS 14.4.2

Is there a way to record the time a user is in specific page?

For example, I have a home page. I want to record the period of time (maybe in seconds or minutes) that a user stays on this page. Is there a function to do so using amplitude? I couldn't find a related function in the document so i'm wondering if i missed some information. Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.