gpt4 book ai didi

eclipse - 如何添加依赖项到libgdx项目?

转载 作者:行者123 更新时间:2023-12-03 05:14:02 26 4
gpt4 key购买 nike

我创建了一个没有freetype字体扩展名的Libgdx项目,后来意识到我需要它。

我将依赖项添加到build.gradle文件中,并重新构建了gradle构建(在eclipse中,对于每个项目,右键单击-> Gradle-> Refresh Gradle Project),但仍然无法使用该库。尝试导入某些内容时,出现“导入com.badlogic.gdx.graphics.g2d.freetype无法解析”的提示。

我做错了什么或想念什么?

这是我的build.gradle文件:

    repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '1.0'
ext {
appName = "X"
gdxVersion = '1.9.0'
roboVMVersion = '1.12.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.7.0'
}

repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}

project(":desktop") {
apply plugin: "java"


dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"

compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
}
}

project(":android") {
apply plugin: "android"

configurations { natives }

dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"

compile "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") {
apply plugin: "java"


dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"

compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
}
}

tasks.eclipse.doLast {
delete ".project"
}

谢谢!

最佳答案

您需要刷新Gradle依赖项

    Right click on your project -> Gradle -> Refresh All

Gradle "Refresh All" in Eclipse

关于eclipse - 如何添加依赖项到libgdx项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36413100/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com