AbedElazizShe / LightCompressor

A powerful and easy-to-use video compression library for android uses MediaCodec API.
Apache License 2.0
518 stars 117 forks source link

Proguard rules #56

Closed melkopisi closed 3 years ago

melkopisi commented 3 years ago

please can you add the library proguard rules cause i can't use it in release it crashes, Here's my logs:

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/aspectj/runtime/reflect/Factory; at com.coremedia.iso.boxes.FileTypeBox.ajc$preClinit(SourceFile:1) at com.coremedia.iso.boxes.FileTypeBox.<clinit>(SourceFile:1) at com.abedelazizshe.lightcompressorlibrary.MP4Builder.createFileTypeBox(SourceFile:165) at com.abedelazizshe.lightcompressorlibrary.MP4Builder.createMovie(SourceFile:68) at com.abedelazizshe.lightcompressorlibrary.Compressor.compressVideo(SourceFile:139) at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(SourceFile:97) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33) at kotlinx.coroutines.q0.run(SourceFile:106) at kotlinx.coroutines.r2.a.p(SourceFile:571) at kotlinx.coroutines.r2.a$b.c(SourceFile:738) at kotlinx.coroutines.r2.a$b.m(SourceFile:678) at kotlinx.coroutines.r2.a$b.run(SourceFile:665) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.aspectj.runtime.reflect.Factory" on path: DexPathList[[zip file "/data/app/com.test.myApp-YNBFyblaZMaQiAeyzfwhAg==/base.apk"],nativeLibraryDirectories=[/data/app/com.test.myApp-YNBFyblaZMaQiAeyzfwhAg==/lib/arm64, /data/app/com.test.myApp-YNBFyblaZMaQiAeyzfwhAg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.coremedia.iso.boxes.FileTypeBox.ajc$preClinit(SourceFile:1) at com.coremedia.iso.boxes.FileTypeBox.<clinit>(SourceFile:1) at com.abedelazizshe.lightcompressorlibrary.MP4Builder.createFileTypeBox(SourceFile:165) at com.abedelazizshe.lightcompressorlibrary.MP4Builder.createMovie(SourceFile:68) at com.abedelazizshe.lightcompressorlibrary.Compressor.compressVideo(SourceFile:139) at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(SourceFile:97) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33) at kotlinx.coroutines.q0.run(SourceFile:106) at kotlinx.coroutines.r2.a.p(SourceFile:571) at kotlinx.coroutines.r2.a$b.c(SourceFile:738) at kotlinx.coroutines.r2.a$b.m(SourceFile:678) at kotlinx.coroutines.r2.a$b.run(SourceFile:665)

AbedElazizShe commented 3 years ago

Thank you for opening this issue. I will fix this as soon as possible. Will inform you. Thank you

AbedElazizShe commented 3 years ago

Could you please share your proguard-rules so I can understand which rule is causing this, I can't reproduce it.

melkopisi commented 3 years ago

I don't have one it's happening when i set minify = true in gradle

AbedElazizShe commented 3 years ago

Could you please try something like this ?

-keep class implements com.coremedia.iso.boxes.Box { ; } -dontwarn com.coremedia.iso.boxes.* -dontwarn com.googlecode.mp4parser.authoring.tracks.mjpeg. -dontwarn com.googlecode.mp4parser.authoring.tracks.ttml.

Let me know if it works. Thank you.

melkopisi commented 3 years ago

It seems that the last version fixed the proguard issue in the release but created another issue now in release when we compress the videos don't have any metadata so I can't complete my video processing.

PS: when I add Sillicompressor library besides your library it fixes the metadata issue for now

melkopisi commented 3 years ago

after some investigations, we found that when we add this jar lib: aspectjrt-1.7.3.jar it fixes the issue for now. So I assume that you're using it with a different version.

AbedElazizShe commented 3 years ago

@melkopisi thank you for the valuable information and I am glad the problem is solved. I believe the version I use is 1.8.2. I will investigate this further. Version 1.7.3 is used in isoparser 1.0.1, and I am using 1.0.6, unfortunately, updating isoparser is really a huge job at this stage. I will definitely work on that in the near future. Thank you.