Libgdx:使用操作系统独立路径'libgdx-freetype.dylib'找到多个文件 [英] Libgdx: More than one file was found with OS independent path 'libgdx-freetype.dylib'

查看:117
本文介绍了Libgdx:使用操作系统独立路径'libgdx-freetype.dylib'找到多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

程序员您好,

我在构建带有freetype字体依赖项的Android libgdx游戏时遇到了麻烦.

I’m having trouble building my libgdx Game for Android with freetype font dependencies.

Libgdx版本:1.9.8

Libgdx version: 1.9.8

版本版本:3.2.0

Gradle version: 3.2.0

Android Studio版本:3.1.4

Android Studio version: 3.1.4

即使对于在build.gradle根文件中声明的freetype字体和项目清理没有任何依赖性,在尝试为Android进行构建时,我也会收到以下错误消息:

Even without any dependencies for freetype font declared in the root build.gradle file and cleaning of the project I get the following Error when trying to build for Android:

任务':android:transformResourcesWithMergeJavaResForDebug'的执行失败.

Execution failed for task ':android:transformResourcesWithMergeJavaResForDebug'.

使用操作系统独立路径'libgdx-freetype.dylib'找到多个文件

More than one file was found with OS independent path 'libgdx-freetype.dylib'

按照集成自由字体的说明,我添加了以下依赖项,但仍然出现上面的错误.

Following the description for integrating freetype font I added the following dependencies, but I still get the Error above.

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"
    }
}

我尝试了所有可能的compile/implementation/api组合,但似乎无济于事.

I’ve tried every possible combination of compile/implementation/api but nothing seems to work.

在类似的帖子中进行搜索后,我在Android项目的build.gradle文件中添加了以下几行:

After some searching in similar Posts I added the following lines to the build.gradle file in the Android Project:

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

现在尝试为Android构建时出现以下错误:

And now I get the following Error when trying to build for Android:

执行任务失败 ':android:transformDexArchiveWithExternalLibsDexMergerForDebug'.

Execution failed for task ':android:transformDexArchiveWithExternalLibsDexMergerForDebug'.

程序类型已经存在: com.badlogic.gdx.graphics.g2d.freetype.FreeType $ Face

Program type already present: com.badlogic.gdx.graphics.g2d.freetype.FreeType$Face

任何解决此问题的帮助将不胜感激.

Any help resolving this issue would be much appreciated.

创建了一个新项目,复制了我的代码,现在它可以正常工作了.

Created a new Project, copied my code and now it's working...

推荐答案

我和你有同样的错误.

在我的gradle.build文件中,我在核心依赖项下添加了它:

In my gradle.build file I had this added under my core dependencies :

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

我添加了它,为游戏制作了一个纹理打包器,并且我想某些库在运行程序时会产生错误.

I added this to make a texture packer for my game, and I suppose some of the libraries are creating the error when running the program.

只是将其注释掉(我使用实现而不是编译,因为它已被贬值)

just comment it out (I'm using implementation instead of compile because it's depreciated)

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

这篇关于Libgdx:使用操作系统独立路径'libgdx-freetype.dylib'找到多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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