07-17-2022 11:28 AM - edited 07-17-2022 11:42 AM
After spending probably 8 hours trying to install and configure Android Studio I have come to the conclusion that either the SDK or instructions for building any of the SDK samples are outdated. Is there any plan to update the instructions for ones that might work? For example, any instructions related to the NDK or the "Project Structure" window is pretty much totally incorrect. I have had to literally uninstall and re-install Android Studio 4 times today. If I had to list specific errors, there would be at least 10 different mismatches and errors, like NDK is missing a "platforms" directory, Task 'prepareKotlinBuildScriptModel' not found in project, and many other unsolved/undocumented issues.
07-17-2022 11:40 AM - edited 07-17-2022 11:41 AM
07-18-2022 09:17 AM
What instructions are you following? Are you referring to the Native Android Development Software Setup?
https://developer.oculus.com/documentation/native/android/mobile-studio-setup-android/
I see that under "Verify Installation of Correct Packages and Version" it tells you to install Android 8.0. This should be Android 10.0. Relevant link: https://developer.oculus.com/blog/meta-quest-apps-must-target-android-10-starting-september-29/
Regardless of which page it is, they each have a pair of buttons in the bottom left for reporting bugs and commenting on the quality of the page. I recommend submitting your feedback there so that it is routed to the correct team at Meta.
07-31-2022 01:01 PM
I am in the exact same situation as you: ovr_sdk_mobile looks outdated and cannot build out of the box with latest Android Studio (Chipmunk 2021.2.1 Patch 1).
The furthest I could get:
- add a stub in project's build.gradle:
task prepareKotlinBuildScriptModel {
}
- remove line in cflags.mk to have C++ code compile
LOCAL_CFLAGS += -Werror # error on warnings
- Refrain from upgrading android gradle plugin from 4.o to 7.2.1 (reached a dead end with gradle dependencies)
After this the project could sync gradle stuff but compilation fails after passing the build of the native lib on:
Execution failed for task ':VrSamples:VrCubeWorld_Framework:Projects:Android:compileDebugJavaWithJavac'.
> Failed to calculate the value of task ':VrSamples:VrCubeWorld_Framework:Projects:Android:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
> Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, /Users/Gerald/Downloads/ovr_sdk_mobile_1_original_WIP/VrSamples/VrCubeWorld_Framework/Projects/Android/build/generated/ap_generated_sources/debug/out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@313cfcdd) before task ':VrSamples:VrCubeWorld_Framework:Projects:Android:compileDebugJavaWithJavac' has completed is not supported
11-22-2022 07:46 PM
same problem android studio 2021.2.1
12-02-2022 04:51 PM - edited 12-02-2022 06:07 PM
The same issue for me. All instructions are outdated, can't launch or even sync test project with SDK
Upd.:
I found solution and was able to sync the test project. As I tried to launch VrCubeWorld_Framework project so I'll describe things I did for that project (I believe it should be applied for any project you want to launch)
I opened VrCubeWorld_Framework only (not a root project)
1) Project Structure -> Modules -> set android ndk version (I set as 25.1.8937393)
Add ndk.dir to vr-sample local.properties file. That is optional thing, but you will not get additional warning
2) Set gradle version to 6.9.1. I tried to launch 7.6, but got an error
3) Copy gradle directory (with gradle wrapper inside) from root project (OculusSDK) to VrCubeWorld_Framework folder
4) add task for VrCubeWorld_Framework inside build.gradle
task prepareKotlinBuildScriptModel {
}
After that it synced succesfully and project tab was updated like this
Next step: I tried to "make a project" and got error. It said me "sdk 33.0.1 is corrupted, please, reinstall" (i use 33.0.1 sdk). In that case you need to go to your androidSDK/build-tools and copy dx.bat and lib/dx.jar from 29.0.2 sdk (it will be downloaded during sync if missing) to the same locations for your sdk build tools (33.0.1 in my case). I found this solution here https://ngoclb.com/2022/11/android-build-failed-installed-build-tools-revision-33.0.1-is-corrupted..... but I did not replaced existing files, only added missing (to not break my 33.0.1 sdk tools)
After that I got error from cpp files like "this variable is declared, but not used"
I used solution provided by gerald.guyomard (thank you!)
- remove line in cflags.mk to have C++ code compile
LOCAL_CFLAGS += -Werror # error on warnings
After that on build project I got an error "keystore file not found for signing config 'debug'"
There are several solutions I found in Internet, I used next one:
Open git terminal and go to VrCubeWorld_Framework/Projects/Android
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
P.S.: don't change OculusSDK packaging and do not extract VrSamples as it uses "parent folder" to get needed files
P.P.S: I didn't try to make this project up-to-date to target sdk and other yet, that's just my guide how to build existing on
06-05-2023 07:21 AM - edited 06-12-2023 01:42 PM
sdk.dir=C\:\\Users\\Josea\\AppData\\Local\\Android\\Sdk
classpath 'com.android.tools.build:gradle:4.0.0'.
classpath "com.android.tools.build:gradle:7.0.2"
distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-all.zip
06-09-2023 10:02 AM
@joseangelmt You're a life saver! I followed your steps and it worked for me, saving me hours of frustration. Much appreciated!
07-20-2023 02:17 AM
But I still meet some errors when I deployed to Occulus Qurest 2, can you give some help?
Caused by: com.android.builder.errors.EvalIssueException: [CXX1405] error when building with ndkBuild using D:\Meta\Open XR\XrSamples\XrSpatialAnchor\Projects\Android\jni\Android.mk: Build command failed.
07-20-2023 03:04 AM