Error: package com.oculus.vrappframework does not exist

415 views Asked by At

I'm trying out the Oculus Mobile SDK V1.0.4, following the instructions at Android Studio Basics.

I imported the build.gradle file for VrCubeWorld_Framework and when switching to the Project view, all dependencies are shown in bold, including VrAppFramework.

When I try to build it though, I don't get very far. The first error I get is:

error: package com.oculus.vrappframework does not exist

in vrcubeworld\MainActivity.java.

It seems pretty obvious what's going on, it doesn't know about the activity in the framework, but how do I make that connection? Do I need to add it as an external library / project or something? Since it's already bold, I thought that would have been taken care of.

For reference, here is the build.gradle:

apply plugin: 'com.android.application'
apply from: "${rootProject.projectDir}/VrApp.gradle"

dependencies {
  compile project(':VrAppFramework:Projects:AndroidPrebuilt')
  compile project(':VrAppSupport:VrGUI:Projects:AndroidPrebuilt')
  compile project(':VrAppSupport:VrLocale:Projects:AndroidPrebuilt')
  compile project(':VrAppSupport:VrSound:Projects:AndroidPrebuilt')
}

android {
  project.archivesBaseName = "vrcubeworldfw"

  defaultConfig {
    applicationId "com.oculus.vrcubeworldfw"
  }

  compileSdkVersion 19
  buildToolsVersion '23.0.1'

  buildTypes {
    debug {
      jniDebuggable true
    }
  }

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

There are 1 answers

4
texel On BEST ANSWER

This sums up the exact cause of the error Oculus Forums. However, after some digging it gets the build type from the task name.

Don't call:

gradle build

call:

gradle assembleDebug

EDIT FOR ANDROID STUDIO:

I'm working out of a non-vanilla oculus vr project so some of my changes may not apply. However, I found that the issue with android studio is that it passes in the full path of the task to gradle for building. And inside the build.gradle file it checks to see if the whole task name is "assembleDebug"

Relevant Source in build.gradle:

  if ( project.file("build.gradle").exists() ) {
    project.gradle.startParameter.taskNames.each { taskName -> 
        if ( taskName == "assembleDebug" || taskName == "assembleRelease" || taskName == "clean" ) {
          if ( project.hasProperty( "buildType" ) ) {
            //throw new GradleException( "cannot configure multiple build tasks" )
          }
          project.ext.buildType = taskName - "assemble"
       }
    }
  }

Changing it to check if the task contains release or debug helped me alot:

  if ( project.file("build.gradle").exists() ) {
    project.gradle.startParameter.taskNames.each { taskName -> 
        if (taskName.contains( "Debug" ) ) {
          project.ext.buildType = "Debug";
        } else if( taskName.contains( "Release" ) ) {
          project.ext.buildType = "Release";
        }    
    }
  }