Libgdx:多个文件被发现独立于操作系统的路径“libgdx-freetype.dylib”(Li

2019-11-05 06:13发布

你好老乡程序员,

我无法建立我的Android libgdx游戏与FreeType字体的依赖。

Libgdx版本:1.9.8

摇篮版本:3.2.0

安卓Studio版本:3.1.4

即使没有在这个项目我在尝试建立Android如果出现以下错误的根的build.gradle文件和清洗声明FreeType字体任何依赖关系:

执行失败的任务“:机器人:transformResourcesWithMergeJavaResForDebug”。

多个文件中发现了独立于操作系统的路径“libgdx-freetype.dylib”

继整合FreeType字体的说明中添加以下的依赖关系,但我仍然得到上述错误。

project(":desktop") {
    …
    dependencies {
        …
        //freetype font
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
    }
}

project(":android") {
        …
    dependencies {
        …
        //freetype font
        api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
    }
}

project(":core") {
        …
    dependencies {
        …
        //freetype font
        implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    }
}

我试过编译/实施/ API的每一个可能的组合,但似乎没有任何工作。

在类似的帖子经过一番搜索,我添加以下行,在Android项目中的build.gradle文件:

android {
    …
    packagingOptions {
        …
        pickFirst 'libgdx-freetype.dylib'
        pickFirst 'libgdx-freetype64.dylib'
        pickFirst 'gdx-freetype.dll'
        pickFirst 'gdx-freetype64.dll'
    }
    …
}

现在我在尝试建立Android如果出现以下错误:

执行失败的任务“:机器人:transformDexArchiveWithExternalLibsDexMergerForDebug”。

节目类型已经存在:com.badlogic.gdx.graphics.g2d.freetype.FreeType $脸

任何解决此问题的帮助将非常感激。

编辑:创建一个新的项目,复制我的代码,现在它的工作...

Answer 1:

我有同样的错误,你。

在我gradle.build文件我这下我的核心依赖补充说:

implementation "com.badlogicgames.gdx:gdx-tools:$gdxVersion" 

我说这使纹理打包机为我的比赛,我想一些库运行程序时产生错误。

只是注释掉(我使用的实施,而不是编译,因为它的贬值)

//implementation "com.badlogicgames.gdx:gdx-tools:$gdxVersion"


文章来源: Libgdx: More than one file was found with OS independent path 'libgdx-freetype.dylib'