使用同一库的不同版本-使用与操作系统无关的路径'builddef.lst'找到多个文件 [英] Using different versions of same library - More than one file was found with OS independent path 'builddef.lst'

查看:121
本文介绍了使用同一库的不同版本-使用与操作系统无关的路径'builddef.lst'找到多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用两个库来修剪和压缩视频: 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"找到了多个文件

More than one file was found with OS independent path 'builddef.lst'

我已经尝试过的东西

在包装选项中排除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:

程序类型已存在:com.coremedia.iso.BoxParser 消息{种类=错误,文本=程序类型已存在: com.coremedia.iso.BoxParser,sources = [未知源文件],工具 name = Optional.of(D8)}

Program type already present: com.coremedia.iso.BoxParser Message{kind=ERROR, text=Program type already present: com.coremedia.iso.BoxParser, sources=[Unknown source file], tool name=Optional.of(D8)}

从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.

java.lang.NoClassDefFoundError:无法解决以下问题:Lcom/googlecode/mp4parser/FileDataSourceViaHeapImpl; 在life.knowledge4.videotrimmer.utils.TrimVideoUtils.genVideoUsingMp4Parser(TrimVideoUtils.java:72) 在life.knowledge4.videotrimmer.utils.TrimVideoUtils.startTrim(TrimVideoUtils.java:65) 在life.knowledge4.videotrimmer.K4LVideoTrimmer $ 5.execute(K4LVideoTrimmer.java:354) 在life.knowledge4.videotrimmer.utils.BackgroundExecutor $ Task.run(BackgroundExecutor.java:212) 在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:428) 在java.util.concurrent.FutureTask.run(FutureTask.java:237) 在java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:607) 在java.lang.Thread.run(Thread.java:761)

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/googlecode/mp4parser/FileDataSourceViaHeapImpl; at life.knowledge4.videotrimmer.utils.TrimVideoUtils.genVideoUsingMp4Parser(TrimVideoUtils.java:72) at life.knowledge4.videotrimmer.utils.TrimVideoUtils.startTrim(TrimVideoUtils.java:65) at life.knowledge4.videotrimmer.K4LVideoTrimmer$5.execute(K4LVideoTrimmer.java:354) at life.knowledge4.videotrimmer.utils.BackgroundExecutor$Task.run(BackgroundExecutor.java:212) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)

从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:-

  1. 创建一个结合两个库(kl-trimmer和Silicompressor)的新库.就我而言,是(kl-trimmer和VideoCompressor( https://github.com/fishwjy/VideoCompressor/)).
  2. 在您的库中使用isoparser-1.0.6.jar.
  3. 现在,在构建新库之后,您将在库kl-trimmer的类 TrimVideoUtils 中遇到错误.
  4. 错误将针对未找到 FileDataSourceViaHeapImpl .实际上,在更高版本的isoparser中可以使用特定的类.将其更改为 FileDataSourceImpl .
  5. 现在,库将在您的项目中正常构建.
  1. 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/)).
  2. Use isoparser-1.0.6.jar in your library.
  3. Now after building your new library you will get an error in class TrimVideoUtils of library kl-trimmer.
  4. Error will be for FileDataSourceViaHeapImpl not found. Actually particular class is available in higher version of isoparser. Change it to FileDataSourceImpl.
  5. 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'找到多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆