如何一起设置vuforia和libgdx? [英] How to setup vuforia and libgdx together?

查看:93
本文介绍了如何一起设置vuforia和libgdx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我对vuforia和libGDX集成感兴趣。我已经控制了以前的工作,但没有任何一个工作正常,我刚开始学习android和gradle问题。最好的工作是daemontus。但只有他的旧版本的vuforia libgdx正在运行,因为vuforia追踪目标不再支持。但是我需要在我的项目中实现vuforia 5.5。



我已经下载了https://github.com/daemontus/VuforiaLibGDX代码,然后添加了vuforai.jar和也是它的引擎。通过将引擎从所以类型文件更改为jar文件(使文件夹包含so文件的第一个zip然后将扩展名更改为jar),将vuforia和引擎复制到库中的文件夹lib,导入根文件夹与android工作室。然后我将android样式更改为项目文件样式,然后发现库已到位。我右键单击该项目并转到打开模块设置,然后在应用程序选项卡中打开依赖项并将新的vuforia及其引擎添加到依赖项列表。还检查了NDK已存在。我按下了确定。我得到关于gradles的这个错误,似乎我找不到它的解决方案:



错误:(53,0)未找到Gradle DSL方法:'compile( )'可能的原因:

项目'VuforiaLibGDX-master'可能正在使用不包含该方法的Gradle版本。打开Gradle包装器文件生成文件可能缺少Gradle插件。申请Gradle插件



因为最新的vuforia样本的工作方式与我在这里讲述的程序类似。我顺便使用Windows 10。另外我注意到在导入的地方没有找到vuforia,但我已将它添加到依赖项中。 import com.vuforia.Matrix44F;



build.gradle项目:



//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。



buildscript {

存储库{

mavenCentral()

}

依赖项{

classpath'com.android.tools.build:gradle:2.1.2'

}

}



allprojects {

repositories {

mavenCentral()

}

}

Build.gradle.App:



申请插件:'com.android.application'



def VUFORIA_SDK_DIR ='/ Users / daemontus / Library / Vuforia'

def NATIVE_LIB_DIR ='build / lib'

def JAR_DIR ='build / java / vuforia'



android {

compileSdkVersion 23

buildToolsVersion '23 .0.2'



s ourceSets.main {

jni.srcDirs = []

jniLibs.srcDirs = [$ VUFORIA_SDK_DIR / $ NATIVE_LIB_DIR /,lib /]

}



defaultConfig {

applicationIdcom.github.daemontus.renderer

minSdkVersion 15

targetSdkVersion 22

versionCode 1

versionName1.0

}



archivesBaseName = rootProject.projectDir.getName()



buildTypes {

release {

minifyEnabled false

ndk {

abiFiltersarmeabi-v7a

}

}

debug {

minifyEnabled false

debuggable true

ndk {

abiFiltersarmeabi-v7a

}

}

}

}



存储库{

maven {urlhttps://oss.sonatype.org/content/repositories/snapshots /}

}



分机{

gdxVersion ='1.9.3'

}



依赖关系{

编译'com.android.support:appcompat-v7:23.+'

编译com.badlogicgames.gdx:gdx:$ gdxVersion编译com.badlogicgames.gdx:gdx-backend-android:$ gdxVersion编译文件('lib / vEngine.jar')

编译文件('lib / Vuforia.jar')

编译文件('lib / vEngine.jar')

}

java android libgdx vuforia



我尝试过:



我有已下载https://github.com/daemontus/VuforiaLibGDX代码。

Recently i got interested to vuforia and libGDX integration. I have controlled the previous jobs but not any of them were working correctly and im beginner to android and gradle problems. The best one working was for daemontus. but only his old version of vuforia libgdx was working which is not going to be supported anymore for tracing the targets by vuforia. but i need to implement the vuforia 5.5 to my project.

I have downloaded https://github.com/daemontus/VuforiaLibGDX code, then added vuforai.jar and also its engine. By changing the engine from so type file to jar file (making the folder containing the so file first zip and then changed the extension to jar ), copied the vuforia and the engine to the folder lib in your library, imported the root folder with android studio. Then i change the android style to project files style and then found the libraries are in place. I right clicked on the project and went to open module settings, then in app tab i opened dependencies and added the new vuforia and its engine to the dependency list.Also I have checked NDK existed.I pressed ok. i get this error about the gradles which seems I can not find a solution for it:

Error:(53, 0) Gradle DSL method not found: 'compile()' Possible causes:
The project 'VuforiaLibGDX-master' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file The build file may be missing a Gradle plugin. Apply Gradle plugin

cause latest vuforia samples were working like the procedure I told here. I´m using windows 10 by the way. Also I have noticed in import places vuforia was not found however I have added it to the dependencies. import com.vuforia.Matrix44F;

build.gradle project:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}

allprojects {
repositories {
mavenCentral()
}
}
Build.gradle.App:

apply plugin: 'com.android.application'

def VUFORIA_SDK_DIR = '/Users/daemontus/Library/Vuforia'
def NATIVE_LIB_DIR = 'build/lib'
def JAR_DIR = 'build/java/vuforia'

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'

sourceSets.main {
jni.srcDirs = []
jniLibs.srcDirs = ["$VUFORIA_SDK_DIR/$NATIVE_LIB_DIR/", "lib/"]
}

defaultConfig {
applicationId "com.github.daemontus.renderer"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}

archivesBaseName = rootProject.projectDir.getName()

buildTypes {
release {
minifyEnabled false
ndk {
abiFilters "armeabi-v7a"
}
}
debug {
minifyEnabled false
debuggable true
ndk {
abiFilters "armeabi-v7a"
}
}
}
}

repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

ext {
gdxVersion = '1.9.3'
}

dependencies {
compile 'com.android.support:appcompat-v7:23.+'
compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" compile files('lib/vEngine.jar')
compile files('lib/Vuforia.jar')
compile files('lib/vEngine.jar')
}
java android libgdx vuforia

What I have tried:

I have downloaded https://github.com/daemontus/VuforiaLibGDX code.

推荐答案

VUFORIA_SDK_DIR /
VUFORIA_SDK_DIR/


NATIVE_LIB_DIR /,lib /]

}



defaultConfig {

申请ationIdcom.github.daemontus.renderer

minSdkVersion 15

targetSdkVersion 22

versionCode 1

versionName 1.0

}



archivesBaseName = rootProject.projectDir.getName()



buildTypes {

release {

minifyEnabled false

ndk {

abiFiltersarmeabi-v7a

}

}

debug {

minifyEnabled false

debuggable true

ndk {

abiFiltersarmeabi-v7a

}

}

}

}



存储库{

maven {urlhttps://oss.sonatype.org/content/repositories/快照/}

}



分机{

gdxVersion ='1.9.3'

}



依赖项{

compile'c​​om.android.support:appcompat-v7:23.+'

编译com.badlogicgames.gdx:gdx:
NATIVE_LIB_DIR/", "lib/"]
}

defaultConfig {
applicationId "com.github.daemontus.renderer"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}

archivesBaseName = rootProject.projectDir.getName()

buildTypes {
release {
minifyEnabled false
ndk {
abiFilters "armeabi-v7a"
}
}
debug {
minifyEnabled false
debuggable true
ndk {
abiFilters "armeabi-v7a"
}
}
}
}

repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

ext {
gdxVersion = '1.9.3'
}

dependencies {
compile 'com.android.support:appcompat-v7:23.+'
compile "com.badlogicgames.gdx:gdx:


gdxVersioncompilecom.badlogicgames.gdx:gdx-backend-android:
gdxVersion" compile "com.badlogicgames.gdx:gdx-backend-android:


这篇关于如何一起设置vuforia和libgdx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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