错误:压缩器是抽象的;不能实例化为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)

implementation 'id.zelory:compressor:2.1.1'

在您的 gradle 上使用此依赖项 和导入

import id.zelory.compressor.Compressor;

该版本对我有用:

implementation 'id.zelory:compressor:2.1.1'

就我而言,版本 2.1.1 帮助了我,它工作正常。

最新更新