【问题标题】:Error with building Google VR SDK sample code构建 Google VR SDK 示例代码时出错
【发布时间】:2018-06-19 03:11:22
【问题描述】:

我是开发 android 程序的新手,我正在努力让示例代码“ndk-treasurehunt”运行。我按照说明构建项目并遇到了许多错误。修改 build.gradle 文件后,我能够取得一些进展,但现在我仍然遇到以下错误。


构建命令失败。 使用参数执行进程 C:\Users\xxx\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe 时出错 {--build C:\Users\xxx\ProgrammingAndroid\gvr-android-sdk -1.150.0\samples\ndk-treasurehunt.externalNativeBuild\cmake\debug\x86 --target Treasurehunt_jni} 忍者:错误:'../../../../libraries/jni/x86/libgvr.so',需要'../../../../build/intermediates/cmake/debug /obj/x86/libtreasurehunt_jni.so',丢失并且没有已知的规则。


我修改的build.gradle是这样的:


apply plugin: 'com.android.application'
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    allprojects {
        repositories {
            jcenter()
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}



android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.google.vr.ndk.samples.controllerpaint"
        minSdkVersion 25
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        externalNativeBuild {
            cmake {
                cppFlags "-std=gnu++11"
                arguments "-DGVR_LIBPATH=${project.rootDir}/libraries/jni",
                        "-DGVR_INCLUDE=${project.rootDir}/libraries/headers"
            }
        }
        buildTypes {
            release {
                minifyEnabled = true
                proguardFiles.add(file("${project.rootDir}/proguard-gvr.txt"))
            }
        }
        ndk {
            // This sample builds all architectures by default. Note that if you
            // only want to build for a specific architecture, you need to
            // remove the appropriate lines below. You also need to remove the
            // .so files from the apk using
            // "packagingOptions {exclude('lib/armeabi-v7a/*')}" in the android
            // section.
            abiFilters "arm64-v8a"
            abiFilters "armeabi-v7a"
            abiFilters "x86"
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}


dependencies {
    implementation 'com.google.vr:sdk-audio:1.150.0'
    implementation 'com.google.vr:sdk-base:1.150.0'
}

build.dependsOn(':extractNdk')

请帮忙!谢谢!

【问题讨论】:

    标签: android cmake google-vr google-vr-sdk


    【解决方案1】:

    请通过执行以下操作确保您的 NDK 已正确安装和提取:

    1. 通过:Tools -> SDK Manager -> SDK Tools -> NDK 将 NDK 添加到 Android Studio
    2. 在IDE底部或通过View -> Tool Windows -> Terminal打开Android Studio Terminal
    3. 在终端gradelw :extractNdk运行以下命令
    4. 在 settings.gradle 中,取消注释以下行 include ':sample:ndk-treasurehunt',如果您使用的是较新的 NDK,则该行已被 include ':samples:ndk-hellovr' 替换

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-27
      • 1970-01-01
      • 2017-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-04
      • 1970-01-01
      相关资源
      最近更新 更多