问题描述
我正在尝试使用两个库来修剪和压缩视频: Silicompressor 和 k4l-video-trimmer .问题是两个库都使用 mp4parser ,但是版本不同.k4l-video-trimmer使用版本1.1.20作为build.gradle中的依赖项,而Silicompressor使用版本1.0.6作为jar文件.现在项目构建良好,但是当我尝试运行它时,出现错误:
i am trying to trim and compress a video using two libraries: Silicompressor and k4l-video-trimmer.the problem is both libraries use mp4parser but different versions of it.k4l-video-trimmer is using version 1.1.20 as a dependency in build.gradle and Silicompressor is using version 1.0.6 as a jar file.now the project builds fine but when i try to run it, i get the error:
我已经尝试过的东西
在包装选项中排除builddef.lst
我在应用程序级别build.gradle中添加了以下几行:
The things i have already tried
Exclude builddef.lst in packaging options
i added these lines in app level build.gradle:
android {
packagingOptions {
exclude 'builddef.lst'
exclude 'version.txt'
exclude 'isoparser-default.properties'
}
}
然后我遇到另一个我无法解决的错误:
and then i got another error which i was unable to solve:
从k4l-video-trimmer中排除mp4parser
我用过
implementation ('life.knowledge4:k4l-video-trimmer:1.0') {
exclude group: 'com.googlecode.mp4parser'
}
代替
implementation 'life.knowledge4:k4l-video-trimmer:1.0'
现在,当我尝试修剪视频时,项目运行并崩溃.
and now the project runs and crashes when i try to trim a video.
从Silicompressor中排除mp4parser
我导入了Silicompressor的模块,而不是使用依赖关系行,并删除了mp4parser的jar文件,以强制该库使用版本1.1.20.现在应用再次运行,但压缩的视频没有音频!Exclude mp4parser from Silicompressor
i imported Silicompressor's module instead of using dependency line and removed mp4parser's jar file to force the library to use the version 1.1.20. now app runs again but the compressed video has no audio!
我用jarjar重新打包了Silicompressor使用的jar文件,从com.googlecode.mp4parser到org.repackage.com.googlecode.mp4parser.仍然有同样的问题.
i used jarjar to repackage the jar file Silicompressor was using from com.googlecode.mp4parser to org.repackage.com.googlecode.mp4parser. still having the very same issue.
这是我的应用程序级别的build.gradle文件:
here's my app level build.gradle file:
apply plugin: 'com.android.application'
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "---"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
google()
jcenter({url "http://jcenter.bintray.com/"})
mavenLocal()
jcenter()
maven { url "http://jzaccone.github.io/SlidingMenu-aar" }
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
/*packagingOptions {
exclude 'builddef.lst'
exclude 'version.txt'
exclude 'isoparser-default.properties'
}*/
}
dependencies {
...
implementation ('life.knowledge4:k4l-video-trimmer:1.0') {
exclude group: 'com.googlecode.mp4parser'
}
implementation 'com.iceteck.silicompressorr:silicompressor:2.1'
}
感谢您的光临!
推荐答案
在 @MilanPansuriya 的帮助下,我终于能够解决此问题.请按照以下步骤解决上述问题:-
With the help of @MilanPansuriya I was finally able to solve the issue. Follow below steps to resolve above issue:-
- 创建一个结合两个库(kl-trimmer和Silicompressor)的新库.就我而言,是(kl-trimmer和VideoCompressor( https://github.com/fishwjy/VideoCompressor/)).
- 在您的库中使用isoparser-1.0.6.jar.
- 现在,在构建新库之后,您将在库kl-trimmer的类 TrimVideoUtils 中遇到错误.
- 错误将针对未找到 FileDataSourceViaHeapImpl .实际上,在更高版本的isoparser中可以使用特定的类.将其更改为 FileDataSourceImpl .
- 现在,库将在您的项目中正常构建.
- Create a new library combining both libraries (kl-trimmer and Silicompressor). In my case it was (kl-trimmer and VideoCompressor (https://github.com/fishwjy/VideoCompressor/)).
- Use isoparser-1.0.6.jar in your library.
- Now after building your new library you will get an error in class TrimVideoUtils of library kl-trimmer.
- Error will be for FileDataSourceViaHeapImpl not found. Actually particular class is available in higher version of isoparser. Change it to FileDataSourceImpl.
- Now library will build just fine in your project.
注意:-这两个库现在都可以正常工作,但是由于我们已将 FileDataSourceViaHeapImpl 更改为 FileDataSourceImpl ,有时我在修剪一些大尺寸的视频(显然,这是发生在老版本的kl-trimmer用户的报告中).
Note:- Both libraries will work fine now, but since we have changed FileDataSourceViaHeapImpl to FileDataSourceImpl sometimes I am getting Out Of Memory while trimming some large size videos (which is obviously supposed to happen & is also reported by users of older version of kl-trimmer).
到目前为止,这是我能够获得的唯一解决方案.如果有人有更好的解决方案,请也更新我们.谢谢.
As of now this is the only solution I am able to get. If someone have a better solution please update us too. Thanks.
这篇关于使用同一库的不同版本-使用与操作系统无关的路径'builddef.lst'找到多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!