amplitude / amplitude-reactnative Goto Github PK
View Code? Open in Web Editor NEWOfficial Amplitude React Native SDK
License: MIT License
Official Amplitude React Native SDK
License: MIT License
How to change minTimeBetweenSessionsMillis from js or sessionTimeout?
Hi,
While browsing the docs, I encounter the following sentence:
You can retrieve the Device ID that Amplitude uses with Amplitude.getInstance().getDeviceId(). This method can return null if a Device ID has not been generated yet.
However, the types list it as returning a string:
Amplitude-ReactNative/src/types.ts
Line 27 in 183a6b0
Shouldn't this be changed to getDeviceId(instanceName: string): Promise<string | null>;
?
Test suite failed to run
TypeError: Cannot read property 'getInstance' of undefined
import { Amplitude } from '@amplitude/react-native';
const ampInstance = Amplitude.getInstance();
Hi there,
we've added this module to our project and it works well when we try it in our test clients. It does unfortunately not log any errors in production. After further debugging it appears that it doesn't even try to talk to the Amplitude API when logging events.
Anyone else seeing a similar issue?
Cheers,
Sascha
Can this SDK be used to also track events on sites using React Native Web, or should the JavaScript SDK be used instead?
I'm getting the following error trying to run this on Android with react-native 0.64.0.
BUILD FAILED in 29s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/mohammed/code/rn-app/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:15: error: cannot find symbol
import com.amplitude.reactnative.AmplitudeReactNativePackage;
^
symbol: class AmplitudeReactNativePackage
location: package com.amplitude.reactnative
/Users/mohammed/code/rn-app/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:71: error: cannot find symbol
new AmplitudeReactNativePackage(),
^
symbol: class AmplitudeReactNativePackage
location: class PackageList
Note: /Users/mohammed/code/rn-app/android/app/src/debug/java/com/myapp/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Any ideas?
Hello, I'm getting this error when I install the package:
The Swift pod `amplitude-react-native` depends upon `Amplitude`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
Could you help with that?
Hey there! 👋 Long time users, first time crash reporters!
We use this package in Jitsi Meet and on our latest release (which uses version 2.3.3 of this package) I'm seeing the following crash in Crashlytics:
Crashed: com.facebook.react.AmplitudeReactNativeQueue
0 libobjc.A.dylib 0x25c80 objc_retain + 16
1 libswiftFoundation.dylib 0x22f4 static String._unconditionallyBridgeFromObjectiveC(_:) + 28
2 JitsiMeetSDK 0x601dd0 specialized ReactNative.getDeviceId(_:resolver:rejecter:) + 56 (AmplitudeReactNative.swift:56)
3 JitsiMeetSDK 0x6008dc @objc ReactNative.getDeviceId(_:resolver:rejecter:) + 7028 (<compiler-generated>:7028)
4 CoreFoundation 0x12e724 __invoking___ + 148
5 CoreFoundation 0x1d04 -[NSInvocation invoke] + 380
6 CoreFoundation 0x2308 -[NSInvocation invokeWithTarget:] + 80
7 JitsiMeetSDK 0x54bf60 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 572 (RCTModuleMethod.mm:572)
8 JitsiMeetSDK 0x54e10c facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&) + 108 (RCTNativeModule.mm:108)
9 JitsiMeetSDK 0x54de7c invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 365 (Optional.h:365)
10 libdispatch.dylib 0x2a84 _dispatch_call_block_and_release + 32
11 libdispatch.dylib 0x481c _dispatch_client_callout + 20
12 libdispatch.dylib 0xc004 _dispatch_lane_serial_drain + 620
13 libdispatch.dylib 0xcc00 _dispatch_lane_invoke + 404
14 libdispatch.dylib 0x174bc _dispatch_workloop_worker_thread + 764
15 libsystem_pthread.dylib 0x37a4 _pthread_wqthread + 276
16 libsystem_pthread.dylib 0xa74c start_wqthread + 8
Does it ring a bell? I checked the changelog for all further versions, but there is no mention of a fix for this crash AFAICT.
hi guys! appreciate to make good service. I'm using your service in React-Native.
I send Revenue to using logRevenue() with local iaps receipt. but amplitude console not showing revenue event.
This was tested in sandbox and google Integrity environment locally.
doesn't make sure i could see LTV graph because in amplitude developer docs said that for tracking iaps, we need to enable revenue verification. but in React-Native SDK there is no method about revenue verification.
i have no idea what can i do for. can i get some advice please?
function trackRevenue(
productName: string,
bill: any
): Promise<void> {
const { signatureAndroid } = bill;
console.log('signature: ', signatureAndroid);
const userProperties: RevenueProperties = {
price: 7900,
productId: 'membership',
quantity: 1,
receipt: JSON.stringify(bill),
receiptSignature: signatureAndroid ? signatureAndroid : null,
eventProperties: {
product: productName,
},
};
await ampInstance.logRevenue(userProperties);
}
Any Revenue event graph shows just zero in Amplitude console.
Just wanted to know if amplitude provides any event for app uninstalls?
Hi,
I'm receiving this error even after doing everything from the #46.
I've done all of these:
pod repo update && pod install pod install --repo update pod update amplitude-react-native && pod update Amplitude pod cache clean --all && pod install
When that didn't work, I deleted the Pods folder and Podfile.lock and then reinstalled them, but I'm still running into this same error.
If I try to set the use_modular_headers! in my Podfile, it breaks other packages. Do you have any idea how to fix this error?
> Task :expo-permissions:compileReleaseKotlin FAILED
e: /Users/.../node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (12, 50): Unresolved reference: R
e: /Users/.../node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (19, 52): Unresolved reference: R
e: /Users/.../node_modules/expo-permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (40, 36): Unresolved reference: R
ReactNativeFirebase WARNING: NPM package '@react-native-firebase/analytics' depends on '@react-native-firebase/app' v11.3.3 but found v11.2.0, this might cause build issues or runtime crashes.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':expo-permissions:compileReleaseKotlin'.
> Compilation error. See log for more details
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':expo-permissions:compileReleaseKotlin'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:200)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:198)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.GradleException: Compilation error. See log for more details
at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:14)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:129)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:173)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:168)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:87)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:530)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin(Tasks.kt:455)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(Tasks.kt:376)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:340)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:47)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:555)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:540)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:523)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:271)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:260)
at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:42)
at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:187)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
* Get more help at https://help.gradle.org
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.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 24s
637 actionable tasks: 9 executed, 628 up-to-date
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
When I run react-native run-android
, this error appears.
I don't understand why amplitude is triggering expo.
What would permissions/android/src/main/java/expo/modules/permissions/requesters/BackgroundLocationRequester.kt: (40, 36): Unresolved reference: R
mean?
Packages:
Step Reproduce:
Error:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\PC\Documents\workspace\project\node_modules\@amplitude\react-native\android\build.gradle' line: 14
* What went wrong:
A problem occurred evaluating project ':amplitude_react-native'.
> Failed to apply plugin 'com.android.internal.library'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
Failed to apply plugin 'com.android.internal.library'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changingorg.gradle.java.home
ingradle.properties
.
My build.gradle
firebaseMessagingVersion = "21.1.0"
buildToolsVersion = "30.0.3"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 30
ndkVersion = "22.1.7171670"
kotlinVersion = "1.5.30"
androidXAnnotation = "1.1.0"
androidXBrowser = "1.0.0"
googlePlayServicesVersion = "17.+"
The doc is awful =(
boolean
, but there is no description what the boolean is... and there is no description when the promise will be resolved/rejectedpreappend
method at the doc?it seems the doc was written very incuriously
I believe that this library has built-in type declarations, but warning message comes out when I upgrade library to v2.0.16.
If I downgrade it to v2.0.12, the second latest version, then there is no warning about type declaration.
Could not find a declaration file for module '@amplitude/react-native'. '/Users/mac/[Project root]/node_modules/@amplitude/react-native/lib/commonjs/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/amplitude__react-native` if it exists or add a new declaration (.d.ts) file containing `declare module '@amplitude/react-native';`
And I think any type declaration file such as @types/amplitude__react-native
does not exist in npm.
Do I have to do something to add declaration file?
Hello! Thanks for your work maintaining a React Native library for Amplitude!
I noticed that the React Native SDK doesn't expose the enableForegroundTracking
method, which is highly recommended on Android for accurate session tracking according to the docs.
I can work around this by enabling it in the native code but it would be great to expose this in React Native as well. Developers who aren't familiar with the SDK may not even know that they are missing out on this on Android.
Hi there,
I'm currently integration the Amplitude SDK for React Native and I'm having issues with the setServerZone method. If I set the SDK to use the 'EU' serverZone, my events are not coming through (at least not in the UI of Amplitude, e.g. event streams, user events streams, charts etc.). As soon as I switch back to US and rebuild the app, the events are coming through again.
I init Amplitude as follows:
const initAmplitude = (): Amplitude => {
const amplitudeInstance = Amplitude.getInstance();
amplitudeInstance.init(AMPLITUDE_KEY);
amplitudeInstance.setServerZone('EU');
return amplitudeInstance;
}
NOTE: I've also tried using the alternative method called setServerUrl('https://api.eu.amplitude.com') as described in the docs, but its not working either.
I'm on version @amplitude/react-native": "^2.6.0
and tested on a real iOS device.
Please look into this issue as we need our data to run on EU servers.
The migration guide says you can emulate logEventWithGroups
by calling setGroup
before logEvent
, but setGroup
will add a user to a group. How could you add an event to a group with this function?
Thanks for this new official RN SDK, well appreciated!
Quick question on the event tracking: Currently no optional eventProperties
can be passed to logEvent()
, which deviates from the JS/native SDK's. Is there a plan to allow passing this param in the future? Because I see that at least there are some comments in the code :)
Amplitude-ReactNative/src/index.ts
Line 49 in 49b9f43
Sending Device Identifiers
Your app is using device identifiers (IMEI, MAC address, Build Serial, etc.) and sending identifier data to a remote network address.
This issue is commonly (but not only) found in apps using an outdated Advertising SDK.
Our analysis suggests that for your APK, this behavior is caused by the Advertising SDK(s) 'com.amplitude.api' although there may be additional SDKs or source code contributing to it. To stop receiving this warning, try updating or changing this (these) SDK(s) and check any other SDKs or code that may be using device identifiers.
Sending device identifiers is not a best practice for most use-cases and if you're using this identifier for advertising purposes, this may be a violation of Google Play policies and can affect your app's visibility on the Play Store.
I keep getting this error when building my app using xcodebuild
from the command line.
xcodebuild -workspace ios/APP_NAME.xcworkspace -scheme APP_NAME clean archive -sdk iphoneos -configuration Debug -UseModernBuildSystem=NO -archivePath $PWD/APP_NAME CODE_SIGNING_ALLOWED=NO;
The app builds fine via Xcode UI. This is a react native app, and I tried a bunch of things that didn't work.
libAmplitude.a
from app project's Frameworks folderBuild Active Architecture Only
to NOlibAmplitude.a
along with libPods-APP_NAME.a
Strangely the file it can't find actually exists in the directory. I see two failures of this type (arm64, armv7).
ld: warning: directory not found for option '-L-L/Users/Parth/Library/Developer/Xcode/DerivedData/APP_NAME-atzumsqdaojeyaaukpzreucvvlja/Build/Intermediates.noindex/ArchiveIntermediates/APP_NAME/BuildProductsPath/Debug-iphoneos/Amplitude'
ld: library not found for -lAmplitude
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Final build failure:
The following build commands failed:
Ld /Users/Parth/Library/Developer/Xcode/DerivedData/APP_NAME-atzumsqdaojeyaaukpzreucvvlja/Build/Intermediates.noindex/ArchiveIntermediates/APP_NAME/IntermediateBuildFilesPath/APP_NAME.build/Debug-iphoneos/APP_NAME.build/Objects-normal/arm64/APP_NAME normal arm64
Ld /Users/Parth/Library/Developer/Xcode/DerivedData/APP_NAME-atzumsqdaojeyaaukpzreucvvlja/Build/Intermediates.noindex/ArchiveIntermediates/APP_NAME/IntermediateBuildFilesPath/APP_NAME.build/Debug-iphoneos/APP_NAME.build/Objects-normal/armv7/APP_NAME normal armv7
(2 failures)
I recently migrated my RN project from Amplitude-Javascript to Amplitude-ReactNative, version 2.0.12 .
The project uses Typescript, and Jest serves as the Testing Framework.
When I run the project on a device, everything works perfectly.
However, when I run tests, for each test suite that includes analytics-calling code, I get a similar error:
Calling jest MyComponent-test
:
app/core/MyModule/MyComponent-test.tsx
● Test suite failed to run
Cannot find module '../package.json' from 'node_modules/@amplitude/react-native/lib/commonjs/constants.js'
Require stack:
node_modules/@amplitude/react-native/lib/commonjs/constants.js
node_modules/@amplitude/react-native/lib/commonjs/index.js
app/core/analytics/analytics.ts
app/core/analytics/index.ts
app/core/MyModule/MyComponent.tsx
app/core/MyModule/MyComponent-test.tsx
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
at Object.<anonymous> (node_modules/@amplitude/react-native/lib/commonjs/constants.ts:1:1)
The lib/commonjs/ directory indeed does not contain a
package.json`.
I followed the migration instructions here to the letter.
Is there anything I'm missing, and can fix on my end?
Amplitude.getInstance().logEvent('BUTTON_CLICKED'); - throws above error.
We have an environment switcher in our application. On env switch, we restart our app and initialize Amplitude with a new apiKey. But, no matter how many envs we switch, the events still log to the first project
AsyncStorage.getItem('API').then(env => {
const ampInstance = Amplitude.getInstance();
if (env && env !== PROD_API) {
ampInstance.init(DEV_ANALYTICS_KEY);
ampInstance.trackingSessionEvents(true);
} else {
ampInstance.init(PROD_ANALYTICS_KEY);
ampInstance.trackingSessionEvents(true);
}
});
Looks like the react-native SDK doesn't support disabling automatic tracking of properties as defined here:
https://developers.amplitude.com/docs/disabling-automatic-tracking-of-properties
It would be great to have this up & running and should be a fairly simple thing to add. Would be more than happy to get it done & raise a PR if you're looking for contributions.
Hi,
I just migrated to @amplitude/react-native^2.3.3 (from amplitude-js 7.x.x) and I discover that there is no more getSessionId function.
How can I get the sessionId with this package ?
Thanks
I didn't found any reference in the documentation nor in another issues related to how to implement the "Do Not Sell My Personal Information" option for California users.
I only found information related to how to retrieve the users data and how to delete the data. But anyone know how to implement the "Do Not Sell My Personal Information" option?
Should I call .identify()
on every app launch or does Amplitude persist identification info across restarts?
So I am migrating from expo-analytics-amplitude.
In the expo website https://docs.expo.dev/versions/latest/sdk/amplitude/ they redirect to https://github.com/amplitude/Amplitude-ReactNative.
But once I go to the website for React Native SDK I notice this package is "legacy".
And also there this React Native (Beta).
Which one would you recommend I should change to? i am currently on the fence with this.
Also I tried to update to the legacy but I can't see any way to pass options.
Example code:
Amplitude.setTrackingOptions({
disableCarrier: true,
})
Best regards,
To track user sessions i have Enable automatically log start and end session events with Amplitude.getInstance().trackingSessionEvents(true)
but it's not working on Android & iOS side.
i can't get the sessions events in the dashboards.
any help?
Hi there! 👋
Thanks for creating a new react-native library. We're migrating from the JavaScript library because we ran into some issues with async-storage library versions. 😁
The migration guide mention that instead of using logEventWithTimestamp
you can provide a custom timestamp. Can you explain how? By looking at the iOS and Android glue, I suspect that it isn't possible?
Thanks!
I got this issue when tried to install the library.
[!] Unable to determine Swift version for the following pods:
amplitude-react-native
does not specify a Swift version and none of the targets XXX 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."@amplitude/react-native": "^2.0.9",
"react-native": "0.61.5",
Hello,
I'm unable to build my project after adding the amplitude library.
Xcode 13.1
iOS target: 14.0
react-native: 0.64.2
@amplitude/react-native: 2.6.0
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
Undefined symbols for architecture arm64:
"_*swift_FORCE_LOAD*$_swiftQuartzCore", referenced from:
_*swift_FORCE_LOAD*$*swiftQuartzCore*$_amplitude_react_native in libamplitude-react-native.a(AmplitudeReactNative-f2b6b898a0d57adfdea7aa2834ea3141.o)
(maybe you meant: _*swift_FORCE_LOAD*$*swiftQuartzCore*$_amplitude_react_native)
"_*swift_FORCE_LOAD*$_swiftMetal", referenced from:
_*swift_FORCE_LOAD*$*swiftMetal*$_amplitude_react_native in libamplitude-react-native.a(AmplitudeReactNative-f2b6b898a0d57adfdea7aa2834ea3141.o)
(maybe you meant: _*swift_FORCE_LOAD*$*swiftMetal*$_amplitude_react_native)
...
...
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After searching around, I've tried a number of things, such as:
- ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator/libswiftMetal.dylib, missing required architecture arm64 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator/libswiftMetal.dylib (2 slices)
Any other suggestions?
Thanks for your help!
Hi,
With the new version of Amplitude/ReactNative, I can't even initialize the library. I keep getting the error
Cannot read property 'setLibraryName' of undefined
Any clue on how to get fixed?
I updated the @amplitude/react-native from 2.6.0 to 2.11.0. All goes well at debug mode and release mode on simulator. But there are no logs after the app has been released.
@amplitude/react-native: 2.11.0
react-native: 0.67.3
Would it be possible to add support for React Native Web?
Previous issue #44
Environment:
macOS Catalina: 10.15.4
node: 14.15.5
pod: 1.10.1
Packages:
"@amplitude/react-native": "^2.0.11"
"react-native": "0.61.4"
Reproduce:
Run npm install @amplitude/react-native@latest
Run cd ios && pod install
Expected result:
Command pod install
successfully
I tried run commands from issue #46 , but it didn't solve my problem.
If I create an empty project via npx react-native init AwesomeProject
command (react-native version 0.64.0) everything works:
If I create an empty project via npx react-native init AwesomeProject --version 0.61.4
command (react-native version 0.61.4) I get an error:
There is no information about this issue in the documentation https://developers.amplitude.com/docs/react-native-setup
Please provide information on what is the minimum version of react-native that can be used.
Thx.
I have a misunderstanding of how to clean "User ID" after calling Amplitude.getInstance().setUserId("test_user_id")
method.
The documentation says:
"If your app has its own login system that you want to track users with, you can call setUserId at any time."
There is no problem to set it on user login, but what I suppose to do, when user logout? How can I clean "User ID" to avoid all next events be related to him?
includeUtm is used on the JS SDK, how do you do this for the ReactNative side?
When I try to build using Xcode (v12.4), I get the error
Module map file '<home>/Library/Developer/Xcode/DerivedData/<appname>/Build/Products/Debug-iphonesimulator/amplitude-react-native/amplitude_react_native.modulemap' not found
But I can run react-native run ios
fine. How can I fix this build error in Xcode?
I'm trying to run react-native run-android
, and I tried everything (clean cache, remove build and .gradle folders, and re clone the repository), but I can't. The only "red error" that console brings me is:
> Task :amplitude_react-native:generateDebugRFile FAILED
I'm running in an Intel Macbook Pro, Big Sur, Node 14, and React Native 0.66.1.
I think that probably is a general problem, but my partner can run the app in a similar mac without any trouble.
Has anyone had the same mistake?
Thanks
I am facing an issue in one of our projects in my workplace where we have created 2 projects on Amplitude one of which is used for production usage and another for development/testing usage. The events that are being sent from development/testing environment are recorded in the production project on amplitude which should ideally not happen due to different API keys for each environment. We have followed the steps illustrated for installation and usage from the docs
SDK Version
@amplitude/react-native: 2.3.3
Things tried till now
Edit 1:
Dug deeper to check what the exact issue is. We have the amplitude API key defined in an config file from which the right key is fetched depending on the environment in the reducer file. The event from development/test is recorded in the production project on amplitude when environments are switched. Amplitude is not able to differentiate between the two API keys. Is this the expected behaviour?
TypeError: null is not an object (evaluating 'AmplitudeReactNative.setLibraryName')
Stack trace:
node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0
node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
node_modules/regenerator-runtime/runtime.js:293:29 in invoke
node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
node_modules/regenerator-runtime/runtime.js:154:27 in invoke
node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:130:14 in _callTimer
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:181:14 in _callImmediatesPass
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:441:30 in callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:387:6 in __callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in __guard$argument_0
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:364:10 in __guard
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 in flushedQueue
[native code]:null in flushedQueue
[native code]:null in invokeCallbackAndReturnFlushedQueue
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.