error: Compressor is abstract; cannot be instantiated Android

error: Compressor is abstract; cannot be instantiated Android

我正在尝试使用 zetbaitsu/Compressor 压缩图像,我什至在 youtube 上看到了一个教程,但我遇到了这个错误。

错误:压缩器是抽象的;无法实例化

这是代码。

try{
              compressed=new Compressor(this).compressToBitmap(compressedFile);
            }catch (IOException e){
                e.printStackTrace();
            }

我实现了最后一个版本。

implementation 'id.zelory:compressor:2.1.0'

有人可以帮忙吗?

谢谢;D

导入id.zelory:compressor。压缩机 在您的 Java 文件中

将您的导入更改为此 import id.zelory.compressor.Compressor

现在你可以使用 Compressor(context)