Skip to main content
Beauty setters return int. Compare against ErrorCode. Construction and processImage can also throw or return null.

ErrorCode

-1 is invalid argument. -2 is not initialized.

Construction

new BeautyEffectEngine(context, config) throws IllegalArgumentException when:
  • context or config is null
  • config.isValid() is false (no licenseToken and missing appId / appKey)
It does not return null.
License and resource init can still fail asynchronously. Subscribe to engine events:
Auth troubleshooting: Auth & License. Enable logging before construct — see Implement Beauty.

processImage

  • null input or null type → IllegalArgumentException
  • Engine already release()d → null (no exception)
  • Always release() both input and output in a finally block
If you convert the output (convert, toBitmap), release the extra frame too.

Filters, stickers, virtual background

Empty path or empty byte[] returns ErrorCode.INVALID_ARGUMENT. Missing files typically return ErrorCode.IO.
Filter / sticker changes take effect on the next processed frame. A successful setter does not prove the texture uploaded; watch later processImage results and SDK logs.

Logging setup

setLogConfig throws if config or level is null. Create parent directories before enabling file logs.

Out of memory

ErrorCode.OUT_OF_MEMORY or OutOfMemoryError usually means frames are not released, resolution is too high, or heap/direct buffers accumulated.
  • Use ByteBuffer.allocateDirect for camera / packed pixels
  • Release every ImageFrame (including convert results)
  • Prefer FrameType.VIDEO for live camera
  • Do not construct a new engine every frame

Stats for slow frames