Я просто добавил библиотеку к моему проекту Gear VRF, а файл build.gradle для библиотеки не смог найти Oculus sdk. Я получаю ошибку «не копирование файлов Oculus: OVR_MOBILE_SDK не найден, а также« опираясь на жестко закодированные пути и переменные среды; OVR_MOBILE_SDK не найден. В нижней части журнала Gradle я также получаю «выполнение не выполнено для рамки задачи: buildNative. Пользователь /../../ Android/sdk/ndk-bundle/ndk-build закончил с отличным от нуля значением выхода 2. Любая помощь по этому вопросу вопрос ценится, я поставил код build.gradle библиотеки ниже БлагодарностиAndroid Studio не удается найти Oculus SDK
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion '23.0.3'
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
ndk {
moduleName "gvrf"
}
}
task copyOculusFiles(type: Copy) {
println "copying oculus binaries"
if (rootProject.hasProperty("OVR_MOBILE_SDK")) {
def oculusDir = rootProject.property("OVR_MOBILE_SDK")
copy {
from oculusDir+'/VrApi/Libs/Android/VrApi.jar'
into 'src/main/libs'
}
copy {
from oculusDir+'/VrApi/Libs/Android/armeabi-v7a/libvrapi.so'
into 'src/main/libs/armeabi-v7a'
}
copy {
from oculusDir+'/VrAppSupport/SystemUtils/Libs/Android/SystemUtils.jar'
into 'src/main/libs'
}
} else {
println "WARNING: not copying Oculus files; OVR_MOBILE_SDK not found"
}
}
task buildNative(type: Exec) {
if (rootProject.hasProperty("OVR_MOBILE_SDK")) {
environment 'OVR_MOBILE_SDK', rootProject.property("OVR_MOBILE_SDK")
} else {
println "WARNING: relying on hard-coded paths and environment variables; OVR_MOBILE_SDK not found"
}
def ndkbuild = ""
if (rootProject.hasProperty("ANDROID_NDK_HOME")) {
ndkbuild = rootProject.property("ANDROID_NDK_HOME")
ndkbuild += '/'
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
ndkbuild += 'ndk-build.cmd'
} else {
ndkbuild += 'ndk-build'
}
if (rootProject.hasProperty("OVR_MOBILE_SDK")) {
environment 'OVR_MOBILE_SDK', rootProject.property("OVR_MOBILE_SDK")
}
commandLine '/Users/edhillon3/Library/Android/sdk/ndk-bundle/ndk-build', '-C', file('src/main').absolutePath, '-j', 16//, 'NDK_DEBUG=1'
}
buildTypes {
debug {
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
releaseToGitHub {
}
}
sourceSets.main {
java.srcDirs = ['src/main/java', 'src/main/backends/oculus']
jni.srcDirs = [] // no auto generation of Android.mk
// pre-compiled libraries
jniLibs {
srcDir 'src/main/libs'
}
}
task cleanNative(type: Exec) {
def ndkbuild = ""
if (rootProject.hasProperty("ANDROID_NDK_HOME")) {
ndkbuild = rootProject.property("ANDROID_NDK_HOME")
ndkbuild += '/'
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
ndkbuild += 'ndk-build.cmd'
} else {
ndkbuild += 'ndk-build'
}
if (rootProject.hasProperty("OVR_MOBILE_SDK")) {
environment 'OVR_MOBILE_SDK', rootProject.property("OVR_MOBILE_SDK")
}
commandLine '/Users/edhillon3/Library/Android/sdk/ndk-bundle/ndk-build', '-C', file('src/main').absolutePath, '-j', 16, 'clean'
}
clean.dependsOn 'cleanNative'
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative, copyOculusFiles
}
task eclipseZip(type: Zip) {
into('GearVRf/res/') {
from 'src/main/res/'
}
into('GearVRf/libs/') {
from('src/main/libs/') {
exclude 'libassimp.so'
exclude 'libjnlua.so'
}
from('build/intermediates/bundles/release/') {
include 'classes.jar'
rename('classes.jar', 'gvrf.jar')
}
}
into('GearVRf/') {
from('src/main/') {
include 'AndroidManifest.xml'
include '.project'
include '.classpath'
include 'project.properties'
}
}
into('GearVRf/java') {
from('src/main/') {
include 'donotdelete.txt'
}
}
baseName 'gvrf-for-eclipse'
}
task eclipseAssembleReleaseToGitHub() << {
println "preparing android library project for eclipse"
eclipseZip.execute()
copy {
from 'build/distributions/gvrf-for-eclipse.zip'
into 'build/outputs/aar/'
}
project.delete('build/distributions/gvrf-for-eclipse.zip')
}
task uploadToGitHub(type: Exec) {
onlyIf {
System.env['RELEASE_ID'] != null
}
onlyIf {
System.env['ACCESS_TOKEN'] != null
}
commandLine '../../tools/upload_to_github', file('build/outputs/aar/framework-releaseToGitHub.aar').absolutePath
}
uploadToGitHub.doFirst {
println('uploading to github')
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'src/main/libs', include: ['*.jar'])
}
assembleDebug {}.doLast {
task copyAARFiles(type: Copy) {
if (rootProject.hasProperty("LIBS_DIRECTORY")) {
println "copying aar files to the libs_directory"
def libsdirPath = projectDir.absolutePath + '/../../../' +
rootProject.property("LIBS_DIRECTORY")
def libsDir = new File(libsdirPath);
if (libsDir.exists()) {
from 'build/outputs/aar'
into libsDir
include '**/*.aar'
} else {
println "Cannot copy aar files, libs directory does not exist!"
}
}
}
assembleReleaseToGitHub {}.doLast {
println 'removing oculus binaries'
exec {
commandLine = ['zip', '-d', 'build/outputs/aar/framework-releaseToGitHub.aar', 'libs/VrApi.jar']
}
exec {
commandLine = ['zip', '-d', 'build/outputs/aar/framework-releaseToGitHub.aar', 'libs/SystemUtils.jar']
}
exec {
commandLine = ['zip', '-d', 'build/outputs/aar/framework-releaseToGitHub.aar', 'jni/armeabi-v7a/libvrapi.so']
}
eclipseAssembleReleaseToGitHub.execute()
uploadToGitHub.execute();
}