Skip to content

RxAmplify.Analytics - Crash #2943

@lolucosmin

Description

@lolucosmin

Before opening, please confirm:

Language and Async Model

RxJava

Amplify Categories

Analytics

Gradle script dependencies

implementation("com.amplifyframework:core:2.24.0") implementation("com.amplifyframework:aws-auth-cognito:2.24.0") implementation("com.amplifyframework:aws-api:2.24.0") implementation("com.amplifyframework:aws-analytics-pinpoint:2.24.0") implementation("com.amplifyframework:aws-storage-s3:2.24.0") implementation("com.amplifyframework:aws-analytics-pinpoint:2.24.0") implementation("com.amplifyframework:rxbindings:2.24.0") coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")

Environment information

# Put output below this line
------------------------------------------------------------
Gradle 8.6
------------------------------------------------------------

Build time:   2024-02-02 16:47:16 UTC
Revision:     d55c486870a0dc6f6278f53d21381396d0741c6e

Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          21.0.3 (JetBrains s.r.o. 21.0.3+-12282718-b509.11)
OS:           Windows 11 10.0 amd64

Please include any relevant guides or documentation you're referencing

Amplify V2

Describe the bug

Hi, I am migrating the project to Amplify 2. I followed the steps in the documentation to initialize then to add plugins and everything was fine.

I created hubs for each plugin and for all of them I have InitializationStatus.SUCCEEDED.
I use RxAmplify in my code and was fine until I tried to record a event with RxAmplify.Analytics.recordEvent(event).
When I run that command i get this error:

java.lang.IllegalStateException: Tried to get a plugin but that plugin was not present. Check if the plugin was added originally or perhaps was already removed.
at com.amplifyframework.core.category.Category.getPluginIfConfiguredOrThrow(Category.java:257)
at com.amplifyframework.core.category.Category.getSelectedPlugin(Category.java:252)
at com.amplifyframework.analytics.AnalyticsCategory.enable(AnalyticsCategory.java:72)
at com.bfan.sso.logic.services.analitycs.AnalyticsTracker.createEvent(AnalyticsTracker.java:33)
at com.bfan.sso.gui.base.fragment.BaseFragment.lambda$onViewCreated$0(BaseFragment.java:88)

As you can see from a base fragment I track the content name.
After a while I decide to use Amplify.Analytics.recordEvent(event) and is works fine.

Issue: RxAmplify.Analytics.recordEvent(event) has a problem.
Mention: I use everywhere in the app RxAmplify

Reproduction steps (if applicable)

No response

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line
java.lang.IllegalStateException: Tried to get a plugin but that plugin was not present. Check if the plugin was added originally or perhaps was already removed.
at com.amplifyframework.core.category.Category.getPluginIfConfiguredOrThrow(Category.java:257)
at com.amplifyframework.core.category.Category.getSelectedPlugin(Category.java:252)
at com.amplifyframework.analytics.AnalyticsCategory.enable(AnalyticsCategory.java:72)
at com.bfan.sso.logic.services.analitycs.AnalyticsTracker.createEvent(AnalyticsTracker.java:33)
at com.bfan.sso.gui.base.fragment.BaseFragment.lambda$onViewCreated$0(BaseFragment.java:88)

amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

Metadata

Metadata

Assignees

Labels

analyticsRelated to the Analytics category/pluginsbugSomething isn't workingrx bindingsThe Rx facade for Amplify

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions