簡體   English   中英

構建Google VR SDK示例代碼時出錯

[英]Error with building Google VR SDK sample code

我是開發Android程序的新手,正在努力使示例代碼“ ndk-treasurehunt”運行。 我按照說明進行了構建項目,並遇到許多錯誤。 修改build.gradle文件后,我可以取得一些進步,但是現在我仍然遇到以下錯誤。


生成命令失敗。 使用參數{--build C:\\ Users \\ xxx \\ ProgrammingAndroid \\ gvr-android-sdk執行進程C:\\ Users \\ xxx \\ AppData \\ Local \\ Android \\ Sdk \\ cmake \\ 3.6.4111459 \\ bin \\ cmake.exe時出錯-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')

請幫忙! 謝謝!

請執行以下步驟,確保正確安裝並解壓縮了您的NDK:

  1. 通過以下Tools -> SDK Manager -> SDK Tools -> NDK將NDK添加到Android Studio: Tools -> SDK Manager -> SDK Tools -> NDK
  2. 在IDE底部或通過View -> Tool Windows -> Terminal打開Android Studio View -> Tool Windows -> Terminal
  3. 在終端gradelw :extractNdk運行以下命令gradelw :extractNdk
  4. 在settings.gradle中,取消注釋以下行include ':sample:ndk-treasurehunt' ,如果您使用的是較新的NDK,則此行已由include ':samples:ndk-hellovr'替換。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM