2016-08-10 6 views
0

oculus mobile sdkのサンプルプロジェクトをビルドしようとすると、以下のエラーが発生しました。oculus mobile SDKのサンプルプロジェクトエラー:ビルドしようとしました:compileReleaseNdk:


エラー:失敗:例外が発生してビルドに失敗しました。

  • : ビルドファイル '〜/ oculus_sdk/ovr_sdk_mobile_1.0.0.1/VrSamples /ネイティブ/ CinemaSDK /プロジェクト/アンドロイド/ build.gradle' 行:28

  • 何が悪かったのか: をプロジェクトの設定に問題が発生しました:VrSamples:Native:CinemaSDK:Projects:Android '

    Could not get unknown property 'compileReleaseNdk' for project ':VrSamples:Native:CinemaSDK:Projects:Android' of type org.gradle.api.Project.

  • してみてください。スタックトレースを取得する--stacktraceオプション付き 実行します。より多くのログ出力を得るには、--infoまたは--debugオプションを指定して実行します。


誰かがこの問題を解決することができますか?

私の開発環境は以下のとおりです。

  • アンドロイドスタジオ2.2
  • のAndroid NDK:アンドロイド - NDK-R12B
  • オクルスモバイルSDK:1.0.0.1
  • OSX 10.11.6

とで言及したのGradleファイルの内容デバッグメッセージは次のようなものでした...

apply plugin: 'com.android.application' 

dependencies { 
    compile name: 'VrAppFramework', ext: 'aar' 
    compile project(':VrAppSupport:SystemUtils:Projects:AndroidPrebuilt') 
    compile project(':VrAppSupport:VrGUI:Projects:AndroidPrebuilt') 
    compile project(':VrAppSupport:VrLocale:Projects:AndroidPrebuilt') 
    compile project(':VrAppSupport:VrSound:Projects:AndroidPrebuilt') 
} 

android { 
    compileSdkVersion 19 
    buildToolsVersion '24.0.1' 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      jniLibs.srcDir 'libs' 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['../../assets'] 
     } 
    } 
} 

project.afterEvaluate { 
    compileDebugNdk.dependsOn 'NDKBuildDebug' 
    compileReleaseNdk.dependsOn 'NDKBuildRelease' 
    clean.dependsOn    'NDKBuildClean' 
} 

android.applicationVariants.all { variant -> 
     variant.outputs.each { output -> 
      def alignedOutputFile = output.outputFile 
      def unalignedOutputFile = output.packageApplication.outputFile 
      def buildTypeName = variant.buildType.name 

      def finalFileName = rootProject.name + "-" + buildTypeName + ".apk" 
      def unAlignedFileName = rootProject.name + "-" + buildTypeName + "-unsigned" + ".apk" 

      output.packageApplication.outputFile = 
        new File(unalignedOutputFile.parent, unAlignedFileName) 

      if (output.zipAlign) { 
       output.outputFile = 
        new File(alignedOutputFile.parent, finalFileName) 
      } 
    } 
} 
+0

が答えを使用してからNDKビルドを無効にしよう役立つことを願っています:http://stackoverflow.com/questions/26271394/getting-error-を実行に失敗したタスクndkが設定されていない – piotrek1543

答えて

0

私はalrea build.gradleファイルにプロパティの下に追加することによって、すべてを行う必要がにある execution failed for task ':app:compileDebugNdk' failed to run this command ndk-build.cmd

Error:Execution failed for task ':app:compileDebugNdk'.

means that the gradle android plugin is trying to call ndk-build itself to compile your sources. You should get more details than the error code in your log window.

Anyway, currently it does this using an auto-generated Makefile and ignores yours, which can't work since you need to integrate ffmpeg.

To overcome this, you should disable the plugin's automatic ndk integration and make it use the standard libs location to get your .so files:

sourceSets.main { 
    jniLibs.srcDir 'src/main/libs' 
    jni.srcDirs = [] //disable automatic ndk-build call 
} 

from there you can call ndk-build yourself, or make gradle call it for you:

import org.apache.tools.ant.taskdefs.condition.Os 

// call regular ndk-build(.cmd) script from app directory 
task ndkBuild(type: Exec) { 
    if (Os.isFamily(Os.FAMILY_WINDOWS)) { 
     commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath 
    } else { 
     commandLine 'ndk-build', '-C', file('src/main').absolutePath 
    } 
} 

tasks.withType(JavaCompile) { 
    compileTask -> compileTask.dependsOn ndkBuild 
} 

For more information on why all this, you can check this gist and my blog post .

をNDK-構築無効:dyが同様の問題に素敵な答えを見つけました。

sourceSets.main { 
     jniLibs.srcDir 'src/main/libs' 
     jni.srcDirs = [] //disable automatic ndk-build call 
    } 

又は第二行削除:

jni.srcDirs = [...]はそれが

関連する問題