korejan / ALVR

Stream VR games from your PC to your headset via Wi-Fi
https://alvr-org.github.io/
MIT License
186 stars 27 forks source link

Building will not continue when kill the java task #97

Closed EstelleSchwarzer closed 1 year ago

EstelleSchwarzer commented 1 year ago

Description

When I build the apk and the process hangs, I kill the process in task manager, but the build doesn't continue but throws an error “process didn't exit successfully” and no apk is generated. I tried to build early using androidstudio, but when I run “cargo xtask” it always opens a new gradle process.

Here's the log daemon-62720.out.log

General Troubleshooting

Environement

Windows 10

Hardware

Note: for Linux, an upload to the hw-probe database is preferred: hw-probe -all -upload

CPU: AMD Ryzen 5 GPU: AMD Radeon RX 6600 XT Audio:

Installation

ALVR @Version:master@009fcc4

SteamVR Version:

Install Type:

OS Name and Version (winver on Windows or grep PRETTY_NAME /etc/os-release on most Linux distributions):win10@19045.3324

elbadcode commented 1 year ago

its most likely an environment variable issue in either windows settings or android studio gradle settings. I set both of those to the openJDK11 path bundled with Visual Studio. I run my quest build in android (make sure path is correct) and then open the outermost folder (with .cargo and .github) in visual studio, open powershell, cd to alvr and run it from there. I don't kill jdk process at all and there is always one running from the initial android build. Pretty annoying having both open and I might be able to just open the folder in terminal, but when I tried cding to the outer folder from android studio powershell it did not build bc it couldnt find the cargo files at the topmost level I guess. I'd try doing that process as well as setting your env variables manually from the terminal after deleting any duplicates in your system properties.

$Env:ANDROID_SDK_ROOT = "C:\Users\your name\AppData\Local\Android\Sdk" $Env:ANDROID_NDK_ROOT = "C:\Users\your name\AppData\Local\Android\Sdk\ndk\25.2.9519653"

shouldnt need to set java home as an env variable because gradle should point directly towards it. hopefully that info helps, don't bother with the killing java process stufff

EstelleSchwarzer commented 1 year ago

@logib I tried to open it with visual studio and enter the build command using visual studio powershell, and it does build without setting JAVA_HOME, but it still has the same problem as before: android studio's build will invoke a new java process, and the build of the apk in visualstudiopowershell also invokes a new java process and continues to hang after gradle build successful

elbadcode commented 1 year ago

@EstelleSchwarzer a few things. first off you shouldn't be building in powershell before android studio. android studio goes first. Second, I noticed this in your log

C/C++: Hard link from 'C:\androidsdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib\aarch64-linux-android\28\libGLESv3.so' to 'D:\ALVR\target\pico-v4\aarch64-linux-android\release\build\alxr-engine-sys-36fd300de58e187c\out\gradle_build\intermediates\cmake\PicoMobileOXR_V4Release\obj\arm64-v8a\libGLESv3.so' failed. Doing a slower copy instead.

Is that actually where your android sdk is installed? Seems like it either doesn't exist there and its looking at the wrong place, or you actually installed it there and its a perms issue. Your sdk should be in your local appdata as I showed in my previous message

$Env:ANDROID_SDK_ROOT = "C:\Users\your name\AppData\Local\Android\Sdk"
$Env:ANDROID_NDK_ROOT = "C:\Users\your name\AppData\Local\Android\Sdk\ndk\25.2.9519653"

If its already there, you need to fix your environment variables in windows settings, delete any path variables set in the settings for android studio under appearance and behavior. image

In advanced settings you can view and exclude windows system variables. These should already be corrected if you've followed along but if not you can click on a name to exclude it, in which case you'd likely need to set a path variable and/or enter the earlier commands again in powershell. You may also need to restart or at least log out of windows when you do this.

If android sdk is actually in your C drive like that, reinstall it to the usual specified place please. You can also run android studio as admin to help with permissions issues but that's a bandaid solution if it works and you might already be doing so. If that message still pops up after fixing the paths then you may need to adjust windows account and folder permissions to ensure you have full control.

Make sure you're on the newest version of android studio as well with all the right build tools and sdk versions. I had to manually upgrade sdk versions as they were set to version 29 by default. sdk version 32 or 33 should work for everything but go with 32 if you're unsure. You may set specific flavors to specific SDK versions in the build variants tab if you want.
image

Again make sure you use the right java version that you specified in java home. I recommend using jvm 11 from visual studio as I previously stated. I have built it with differing java versions but its easier to keep track of if you set everything to be the same as your system environment variable. Do this in the previous screen as well as in your gradle settings.

image

Since we need two java processes to run there may also be memory concerns. Here's what I have setup. No idea if this matters but just a precaution to take if the other advice doesnt help. having both programs open is gonna slow down your pc a lot so be mindful of that. image

After any changes be sure to use these options to clean up your project and sync gradle settings to push the sdk version through. You should also clean all the old build files, including the ones in the outside folders that android studio wouldnt see. image

Once all that is done I'd restart everything to be safe but you should be able to now build a selected flavor in android studio without any of those errors and your visual studio build should now work. It should open a new process of java of course, but if you followed my suggestion there should be two java.exe processes after you build in vs and the android one should stay open. My builds take 30 seconds and the vs java process closes almost instantly

Hopefully that helps

elbadcode commented 1 year ago

did you get it figured out @EstelleSchwarzer? Not many people building this project so I'm happy to help if anything is unclear still

EstelleSchwarzer commented 1 year ago

did you get it figured out @EstelleSchwarzer? Not many people building this project so I'm happy to help if anything is unclear still

Thanks to your help, I have been able to do an apk build.