LogoLogo
Insights
  • Introduction
  • A standard integration
  • FAQ
    • FAQ
      • Integration (FAQ)
      • Detections (FAQ)
      • Data interface (FAQ)
      • Security, Privacy and Terms of Service (FAQ)
      • Journeys and Insights (FAQ)
  • SDK
    • Getting Started
      • Android Quick Start
        • 1. Android Checklist
        • 2. Including the SDK
        • 3. Configuration
          • Sample Notification
        • 4. Initialization
        • 5. Starting Detections
        • 6. SDK Status Updates
        • 7. Permissions
        • 8. What's Next
      • iOS Quick Start
        • 1. iOS Checklist
        • 2. Installation
          • Installation with CocoaPods
          • Installation with Carthage
          • Manual Installation
        • 3. Configuration
          • Using Integration Guide
          • Manual Configuration
        • 4. Usage
        • 5. Tips and Guidelines
        • 6. What's Next
      • React Native Quick Start
        • 1. React Native Checklist
        • 2. Installation
        • 3. Configuration
        • 4. Initialization
        • 5. Usage
        • 6. What's Next
    • Appendix
      • Android
        • Android 10 Update Behavior
        • Android Battery Optimization
        • External SDK Dependencies
        • Manifest Permissions
        • Notification Management
      • iOS
        • App Store Privacy Section
        • App Store Release
        • iOS 13 permission changes
        • M1 Simulator Support
        • Swift Support
      • Control Sending Data
      • Controlled Detections
        • Automatic Detections
        • Automatic Detections with Forced Trips
        • Controlled Trips Only
        • Checking Trip Status
      • Custom User Metadata
      • Detecting Vehicle Crashes
      • Migration Guide
        • Android
        • iOS
      • React Native
      • SDK Initialization
      • User Credentials
      • User Linking
      • Xamarin
    • API Reference
      • Android
        • VehicleCrashDetection
          • VehicleCrashEvent
          • VehicleCrashListener
          • CrashCallback
        • InitState
        • MetaUserLinker
        • MetaUserLinkerAsync
        • MetaUserLinkerCallback
        • OnInitCallback
          • InitIssue
        • OnSdkStatusUpdateHandler
        • OnStartFinishedHandler
        • PoiAddress
        • PoiLocation
        • PointOfInterest
        • PoiPlace
        • ResetCallback
          • ResetFailureReason
        • SdkConfig
          • Builder
        • SdkException
        • SdkStatus
          • LocationSetting
          • Quota Status
          • StartStatus
        • Sentiance
        • SubmitDetectionsCallback
        • StationaryInfo
        • Token
        • TokenResultCallback
        • Trip
          • StartTripCallback
          • StopTripCallback
          • TransportMode
          • TripTimeoutListener
          • TripType
        • TripInfo
        • TripProfile
          • HardEvent
          • TransportSegment
          • VehicleMode
        • TripProfileConfig
          • Builder
        • TripProfileListener
        • UserActivity
        • UserActivityListener
        • UserActivityType
      • iOS
        • MetaUserLinker
        • SENTSDK
          • SENTSDKStatus
          • SENTPublicDefinitions
        • SENTConfig
        • SENTTripProcessingTripProfile
          • SENTTripProcessingTransportSegment
          • SENTTripProcessingHardEvent
          • SENTTripProcessingVehicleMode
        • SENTVehicleCrashEvent
      • React Native
    • Battery Optimization
    • How To
      • Check the Location Permissions
    • Troubleshooting
      • Android
      • iOS
        • Bundle format unrecognized, invalid, or unsuitable
        • Error: Undefined symbols for architecture arm64
    • Changelog
      • Android
      • iOS
  • Important topics
    • Authentication and Authorization
    • User linking
    • PlayStore Location Access Review
    • Privacy Report & Dashboard
    • Vehicle Crash Detection
  • Library
    • Events
    • Moments
    • Segments
    • Glossary
  • Backend
    • GraphQL
    • REST API Reference
      • Error Codes (REST API)
    • Offloads
    • Data Reference
      • Data Reference A-B
      • Data Reference C-G
      • Data Reference H-L
      • Data Reference M-P
      • Data Reference Q-T
      • Data Reference U-Z
  • Data Explorer
    • Data Explorer
      • Global (EU)
      • US
      • Australia
  • Guide
    • Firehose
    • Verifying your integration
    • SDK Standard License
    • Journeys License
    • Journeys Application
    • Journeys Privacy Policy
    • Technical & Organizational Measures
Powered by GitBook
On this page
  • java.lang.RuntimeException: Exception while creating class X
  • Version conflict or mismatch error
  • Manifest merger failed: Attribute fullBackupContent
  • Build failure or runtime exception when using AndroidX
  • Permission revoked when adding the Sentiance SDK
  • Exclude native libraries for unsupported architectures
  1. SDK
  2. Troubleshooting

Android

This document refers to deprecated parts of the platform and has been left intact to help customers with legacy integrations. In order to access the latest platform features and documentation, please go to https://docs.sentiance.com.

java.lang.RuntimeException: Exception while creating class X

com.example.myapp E/Sentiance: Failed to initialize the Sentiance SDK
    java.lang.RuntimeException: Exception while creating class d
       ...
     Caused by: java.lang.reflect.InvocationTargetException
       ...
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/location/LocationServices;

Problem: This error is likely due to the app using a different version of the play-services-* libraries than the Sentiance SDK.

Solution: Exclude the play-services-location library used by Sentiance and include a newer version.

Note: Make sure to include the explicit play-services-location dependency in the app module to avoid potential problems with various versions of the Android gradle plugin, e.g. in a react-native project.

implementation ('com.sentiance:sdk:xxx@aar') { // xxx being the current version of the SDK that is used
    transitive = true
    exclude group: 'com.google.android.gms', module: 'play-services-location'
}
implementation 'com.google.android.gms:play-services-location:16.0.0'

Version conflict or mismatch error

All com.android.support libraries must use the exact same version specification...

Problem: Our SDK has a dependency on the Google Play location services library, which itself has dependencies on various other support libraries. When your application has a dependency on a different version of a play services, support, or location library, it may result in version conflict.

Solution: Exclude the conflicting library from our SDK and include a higher version separately.

// In this example, 'com.android.support' has a conflict.

implementation ('com.sentiance:sdk:4.4.0@aar') {
	transitive = true
	exclude group: 'com.android.support', module: 'support-v4'
}

Manifest merger failed: Attribute fullBackupContent

Manifest merger failed : Attribute application@fullBackupContent value=(@xml/my_backup_rules.xml) from AndroidManifest.xml:10:9-45
        is also present at [com.sentiance:sdk:4.10.0] AndroidManifest.xml:26:9-54 value=(@xml/backup_rules).
        Suggestion: add 'tools:replace="android:fullBackupContent"' to <application> element at AndroidManifest.xml:5:5-21:19 to override.

Problem: If you have specified custom backup rules in your application's manifest using the android:fullBackupContent attribute, then you might run into an exception during the build. This is because our SDK sets its own rules in the library manifest, which causes the manifest merger to complain about the conflict.

Solution: Add the following attribute to your app's <application> tag so that the manifest merger picks your app's backup rules instead:

<manifest xmlns:tools="http://schemas.android.com/tools" ...>
   <application 
      ...
      tools:replace="android:fullBackupContent">

Then, add the following SDK backup rules to your backup rules XML file (location in the res/xml directory):

<exclude domain="sharedpref" path="sentiance.xml"/>
<exclude domain="database" path="sentiance-payloads"/>
<exclude domain="database" path="sentiance-payloads.db"/>
<exclude domain="database" path="sentiance"/>
<exclude domain="database" path="sentiance.db"/>

Build failure or runtime exception when using AndroidX

Build-time Exception

Error while merging dex archives

Error: Program type already present: android.support.v4.app.INotificationSideChannel

Runtime Exception

NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap

Problem: When using AndroidX support libraries or a Google Play Services library which depends on AndroidX libraries, you might run into the above build-time or runtime exception.

Solution: The Sentiance SDK depends on several com.android.support libraries. Therefore, you must enable Jetifier to migrate the SDK's support dependencies to the AndroidX equivalent ones. To do so, add the following lines to your project's gradle.properties file:

gradle.properties
android.useAndroidX=true
android.enableJetifier=true

Permission revoked when adding the Sentiance SDK

Problem: When adding the Sentiance SDK to an app, the READ_PHONE_STATE permission gets revoked or can no longer be acquired at runtime.

Solution: The Sentiance SDK adds this permission to the app and specifies the maxSdkVersion attribute. To remove this attribute, add the tools:remove="android:maxSdkVersion" attribute to the permission in your app's manifest:

AndroidManifest.xml
<uses-permission android:name="android.permission.READ_PHONE_STATE"
                 tools:remove="android:maxSdkVersion"/>

Exclude native libraries for unsupported architectures

Problem: When adding the Sentiance SDK to your app, your final apk may include native libraries for architectures you do not intend to support, unnecessarily increasing the size of your app.

This problem does not affect you if you are publishing your app as an Android App Bundle (aab). Google Play takes care of stripping unnecessary binaries from your final apk.

Solution: You can restrict the architectures that you want to support by adding abiFilters to your build config. Below is an example of how to restrict it to armeabi-v7a and arm64-v8a only, in your release builds.

app/build.gradle
android {

  buildTypes {
    release {
       ndk {
         abiFilters = [ 'armeabi-v7a', 'arm64-v8a ' ]
       }
    }
  }
}
PreviousTroubleshootingNextiOS

Last updated 1 year ago