压缩图片我用了Luban 压缩
Luban.get(this) .load(File) //传人要压缩的图片 .putGear(Luban.THIRD_GEAR) //设定压缩档次,默认三挡 .setCompressListener(new OnCompressListener() { //设置回调 @Override public void onStart() { // TODO 压缩开始前调用,可以在方法内启动 loading UI } @Override public void onSuccess(File file) { // TODO 压缩成功后调用,返回压缩后的图片文件 } @Override public void onError(Throwable e) { // TODO 当压缩过去出现问题时调用 } }).launch(); //启动压缩
配了gradle,compile 'top.zibin:Luban:1.0.9'
出现报错
java.lang.NoClassDefFoundError: Failed resolution of: Lrx/Observable;
Caused by: java.lang.ClassNotFoundException: Didn't find class "rx.Observable" on path: DexPathList[[zip file "/data/app/com.amorIn.online-2/base.apk"],nativeLibraryDirectories=[/data/app/com.amorIn.online-2/lib/arm64, /vendor/lib64, /system/lib64]]
出现崩溃
是少了配置文件
compile 'io.reactivex:rxandroid:1.2.1' compile 'io.reactivex:rxjava:1.1.6'