Troubleshooting
1. Verifying Successful Android SDK Integration
To verify that the Metrix SDK has been successfully integrated:
- In Android Studio, select the connected device
- Open Logcat (View → Tool Windows → Logcat)
- Set the tag filter to
Metrix
Expected log messages:
Metrix initialization complete— SDK initialized successfullyNew custom event received— Event was received from the SDKParcel successfully sent— SDK synchronized data with serverStarting Metrix initialization— Initialization started
If you see error messages:
- Check that
APPLICATION_IDandAPI_KEYare correctly set inAndroidManifest.xml - Verify SDK is not in developer mode (
metrix_developer_mode=false) - Check network connectivity
- Verify ProGuard configuration includes
-keep class ir.metrix.** { *; }
2. SDK Initialization Issues
Issue: “Unable to find appId in application manifest”
Cause: Missing or invalid ir.metrix.APPLICATION_ID metadata
Solution:
<manifest>
<application>
<meta-data
android:name="ir.metrix.APPLICATION_ID"
android:value="YOUR_APP_ID" />
</application>
</manifest>Issue: “Unable to find apiKey in application manifest”
Cause: Missing or invalid ir.metrix.API_KEY metadata
Solution:
<manifest>
<application>
<meta-data
android:name="ir.metrix.API_KEY"
android:value="YOUR_API_KEY" />
</application>
</manifest>Issue: “Running in developer-mode; Metrix won’t function”
Cause: Developer mode is enabled
Solution: Set metrix_developer_mode=false in manifest or remove it entirely:
<meta-data
android:name="metrix_developer_mode"
android:value="false" />Issue: “Unable to retrieve FCM initialization values”
Cause: google-services.json not found or not applied
Solution:
- Download
google-services.jsonfrom Firebase Console - Place in
app/directory (notapp/src/) - Ensure
com.google.gms.google-servicesplugin is applied inbuild.gradle
3. Events Not Appearing in Dashboard
Issue: Events not showing up
Possible causes:
- Event not registered in Metrix panel
- Offline/no network connection
- SDK disabled (
sdkEnabled: false) - Event attributes exceed size limits
Solutions:
- Register events in Event Management section of Metrix panel
- Or use
newEventByName()to auto-create events - Check network connectivity (adb logcat for “offline”)
- Verify each attribute key/value is ≤ 512 bytes
- Verify maximum 50 attributes per event
Issue: Revenue events showing zero amount
Cause: Incorrect data type or currency
Solution:
- Ensure revenue is
Double(not String or Integer) - Specify correct currency:
RevenueCurrency.IRR,USD, orEUR - Verify amount > 0
4. User Tracking Issues
Issue: User ID not being saved
Cause: Called before analytics module initialized
Solution:
- Verify analytics module included:
implementation 'ir.metrix.analytics:metrix:2.8.1' - Set user ID after app fully starts, not in Application.onCreate()
- Use CPU executor for timing issues:
MetrixAnalytics.User.setUserCustomId("userId");Issue: Custom attributes not appearing
Cause: Exceeding size limits or invalid types
Solution:
- Maximum 50 custom attributes per user
- Each key ≤ 512 bytes, each value ≤ 512 bytes
- Use supported types: String, Number, Boolean
- Use ISO 8601 for dates:
"2024-11-20T11:24:03.000Z"
5. Push Notifications Not Received
Issue: Notifications not appearing
Possible causes:
google-services.jsonnot configured- FCM credentials not in Metrix panel
- User ID not set
- Notifications disabled
- Device token not sent to Metrix
Solutions:
- Verify
google-services.json:
app/google-services.json (not src/)-
Check Firebase credentials in Metrix panel:
- Go to Workspace → Settings → Channel Integration → App Push
- Upload Firebase credentials
-
Set user ID:
MetrixAnalytics.User.setUserCustomId("userId");- Verify notifications enabled:
boolean enabled = MetrixNotification.isNotificationEnable();Issue: Firebase service not found
Cause: Service not declared or plugin not applied
Solution:
- Add to
AndroidManifest.xml:
<application>
<service
android:name="ir.metrix.notification.receivers.MetrixFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>- Verify plugin in
build.gradle:
plugins {
id 'com.google.gms.google-services'
}6. In-App Messages Not Showing
Issue: In-app messages not displaying
Possible causes:
- Auto-loading disabled without manual loading
- Messaging paused
- Module not initialized
Solutions:
- If auto-loading disabled, call manually:
MetrixNotification.loadInAppMessages();- Check if paused:
if (MetrixNotification.isInAppMessagingPaused()) {
MetrixNotification.pauseInAppMessages(false);
}- Verify initialization:
if (MetrixNotification.isInitialized()) {
MetrixNotification.loadInAppMessages();
}7. Deep Link Issues
Issue: Deep links not working
Possible causes:
- Intent filter not configured
- Scheme name mismatch
- Listener not set
Solutions:
- Verify intent filter in manifest:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="metrixExample" />
</intent-filter>
</activity>- Set deeplink listener:
MetrixAttribution.setOnDeeplinkResponseListener(deeplink -> {
handleDeeplink(deeplink);
return false; // Handle yourself
});- Handle in onCreate and onNewIntent:
@Override
protected void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
Uri data = intent.getData();
if (data != null) handleDeeplink(data);
}
@Override
protected void onNewIntent(Intent intent) {
Uri data = intent.getData();
if (data != null) handleDeeplink(data);
}Issue: Deferred deeplinks not working
Cause: App not installed via Google Play or Cafe Bazaar
Solution:
- Deferred deeplinks only work with Google Play and Cafe Bazaar
- Install app from store before testing deferred deeplinks
- Set listener before clicking deeplink:
MetrixAttribution.setOnDeeplinkResponseListener(deeplink -> {
return true; // Let Metrix handle
});8. WebView Integration Issues
Issue: WebView not syncing data
Cause: Bridge not registered or already unregistered
Solution:
- Register bridge in
onCreate():
MetrixAnalyticsBridge.registerAndGetInstance(webView);- Enable JavaScript:
webView.getSettings().setJavaScriptEnabled(true);- Unregister only in
onDestroy():
@Override
protected void onDestroy() {
MetrixAnalyticsBridge.unregister();
super.onDestroy();
}Issue: JavaScript methods not available
Cause: Bridge not initialized before loading URL
Solution:
// Register bridge BEFORE loading URL
MetrixAnalyticsBridge.registerAndGetInstance(webView);
// THEN load URL
webView.loadUrl("file:///android_asset/page.html");9. ProGuard/R8 Obfuscation Issues
Issue: ClassNotFoundException or NoSuchMethodError at runtime
Cause: Classes being obfuscated by ProGuard/R8
Solution:
Add to proguard-rules.pro:
-keep class ir.metrix.** { *; }
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }For Gradle 8+:
Add to app build.gradle:
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
proguard.common,
'proguard-rules.pro'
}
}
}10. Session Tracking Issues
Issue: Session listeners not called
Cause: Analytics module not initialized
Solution:
- Verify analytics included:
implementation 'ir.metrix.analytics:metrix:2.8.1' - Set listeners early in activity lifecycle
- Check that app is not in developer mode
Issue: Session ID not available immediately
Cause: Timing issue during initialization
Solution:
- Session ID available by end of
onCreate() - Set listener before any events
- Use
setSessionIdListener()in main activity
11. Attribution Issues
Issue: Attribution data not received
Possible causes:
- Attribution module not initialized
- Network connectivity issues
- User is organic (no campaign)
Solutions:
- Verify module included:
implementation 'ir.metrix.attribution:metrix:2.8.1' - Check network connectivity
- Wait 24-48 hours for server-side attribution
- Check Metrix panel for tracker configuration
Issue: Default tracker not working
Cause: App installed from official store
Solution:
- Never use default tracker on Google Play or Cafe Bazaar
- Default tracker only for direct distribution (website, side-load)
- Remove before publishing to stores
12. FCM Token Management
When do FCM tokens expire?
FCM registration tokens don’t have a fixed expiration time. They remain valid until:
- App is uninstalled/reinstalled
- App data is cleared
- Device is factory reset
- Google rotates tokens (security update)
- User logs out
- Device OS or Play Services major update
Best practices:
- Refresh token periodically (monthly)
- Request new token on app update
- Handle token refresh in
onNewToken()
13. Network and Offline Issues
Issue: “Parcel successfully sent” not appearing
Cause: Offline or network blocked
Solutions:
- Check internet connectivity
- Verify device has active network
- Check firewall isn’t blocking Metrix servers
- Verify API firewall allows outbound HTTPS
- SDK queues events offline, sends when online
14. Common Error Messages
| Error | Cause | Solution |
|---|---|---|
Unable to find Metrix core component | Core module missing or failed to init | Add core dependency, check initialization |
Metrix component not available | Module initialization failed | Check logs for specific error, verify manifest |
WorkManager is needed but not initialized | Notification without WorkManager | Add WorkManager or enable auto-init |
Unable to obtain the Metrix component | SDK not initialized | Verify all dependencies, check manifest |
Initialization will not proceed | Core component not available | Check ProGuard rules, verify dependencies |
15. Getting Help
Debug logs:
adb logcat | grep MetrixCheck manifest:
ir.metrix.APPLICATION_IDsetir.metrix.API_KEYsetmetrix_developer_modenottrue- All required services/receivers declared
Verify dependencies:
implementation 'ir.metrix.analytics:metrix:2.8.1'
implementation 'ir.metrix.attribution:metrix:2.8.1'
implementation 'ir.metrix.notification:metrix:2.8.1'16. Performance Issues
Issue: App startup delay
Cause: Heavy initialization on main thread
Solution:
- SDK uses background threads for heavy operations
- Pre-initialization happens on main thread (~10ms)
- Post-initialization on CPU thread
- Use developer mode to test without network
Issue: High memory usage
Cause: Large event queues or uncleared listeners
Solution:
- Remove listeners when not needed
- Clear event queue periodically
- Check for memory leaks in listeners
- Use Android Profiler to monitor