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')
}
Also I have changed my gradle to something like this but its not working cause vuforia package is not found: I have also changed my gradle like this but still vuforia can not be found:
apply plugin: 'com.android.application'
def VUFORIA_SDK_DIR = 'C:\\Dev\\vuforia-sdk-android-5-5-9'
def NATIVE_LIB_DIR = 'build/lib'
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 fileTree(include: '*.jar', dir: 'libs')
compile files('libs/vuforia.jar')
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
}
Error:(16, 19) error: package com.vuforia does not exist