Link Search Menu Expand Document

Error Handling

The LofeltHaptics API throws exceptions on errors which you need to handle. For example, you could wrap your calls in try statements. See:

Error Handling Example

try {
	haptics.load(hapticClipBytes);
} catch (Exception e) {
	e.printStackTrace();
}

Error Types

In the event you encounter an error message while using the Studio library for Android, the tips below can help resolve the issue. If the error persists even after trying these remedies, please submit a bug report to Lofelt with the details of the error you receive.

Function Called Error Message Recovery Steps
Static initialization while loading the Lofelt SDK library Any exception that System.loadLibrary() throws Make sure that the Lofelt SDK core library (liblofelt_sdk.so) is included in your APK or AAB app package. This should be the case by default when including LofeltHaptics.aar in your project.
Please report this as a bug otherwise.
load() Reading clip data as UTF-8 failed: <error details> The bytes passed to load() are not valid UTF-8.
Try re-exporting the haptic clip from Studio.
Make sure you read the file, asset or resource as a binary file, not a text file. For example use IOUtils.toByteArray() instead of IOUtils.toString().
load() Error validating V0/V1: <error details> Re-export the haptic clip from Studio.
load() Error deserializing V0/V1: <error details> Re-export the haptic clip from Studio.
load() Unsupported version Download the latest version of the Studio library for Android and include this in your app.
load() Any exception that Context::getSystemService() throws Android was unable to find the Vibrator service. Please report this to us as a bug.
load() Any exception that VibrationEffect::createWaveform() throws Android was unable to create a waveform from the haptic clip data. Please report this to us as a bug.
play() Unable to play, no clip loaded Call play() only after a haptic clip was loaded without any errors.
play() Any exception that Vibrator::vibrate() throws Android was unable to play the haptic clip. Please report this to us as a bug.
stop() Unable to stop, no clip loaded Call stop() only after play().
stop() Any exception that Vibrator::cancel() throws Android was unable to stop the playback of the haptic clip. Please report this to us as a bug.

< Prev Next >


Copyright © 2020-2021 Lofelt GmbH. All rights reserved.