Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GameActivity fails with String `` is not a PID #11

Open
Dispersia opened this issue Jul 5, 2023 · 2 comments
Open

GameActivity fails with String `` is not a PID #11

Dispersia opened this issue Jul 5, 2023 · 2 comments

Comments

@Dispersia
Copy link

Dispersia commented Jul 5, 2023

Hello, trying to write a small game for android, however having issues with the GameActivity type. NativeActivity appears fine for me, however upon trying to use GameActivity, I get Error: String `` is not a PID. This happens even in running the examples such as:

https://github.com/Dispersia/rust-android-examples/tree/main/agdk-winit-wgpu
(slightly modified to work with cargo apk run in my environment + proc_macro was broken in latest nightly)

I am using cargo apk run instead of what's in the instructions there, but I believe that does the same thing or is that wrong?

Verifying alignment of /home/dispe/development/rust-android-examples/agdk-winit-wgpu/target/debug/apk/hello.apk (4)...
      49 AndroidManifest.xml (OK - compressed)
     900 lib/armeabi-v7a/libagdk_winit_wgpu.so (OK)
99927512 lib/arm64-v8a/libagdk_winit_wgpu.so (OK)
Verification succesful
Signing `/home/dispe/development/rust-android-examples/agdk-winit-wgpu/target/debug/apk/hello.apk` with keystore `/home
/dispe/.android/debug.keystore`
Performing Incremental Install
Serving... 
All files should be loaded. Notifying the device.
Success
Install command complete in 8784 ms
Starting: Intent { act=android.intent.action.MAIN cmp=io.test.test/android.app.NativeActivity }  
Status: ok
LaunchState: UNKNOWN (0)
Activity: io.test.test/android.app.NativeActivity 
WaitTime: 564
Complete
Error: String `` is not a PID 

Caused by: 
    cannot parse integer from empty string

My environment is running off of Windows Subsystem for Android as I don't have access to an Android phone. If there is any other information I can provide let me know, I didn't know where to get logs that might explain more. Thanks!

@MarijnS95
Copy link
Member

Error: String `` is not a PID from cargo-apk means that the app either hasn't started yet (and we do not recheck this in a loop for some duration of time), or has already crashed.

The PID is only used to filter logs to the application that was built and installed as Android's unfiltered logs are ridiculously spammy, but you could use them to figure out the reason your app fails to start (adb logcat -v color):

I am using cargo apk run instead of what's in the instructions there, but I believe that does the same thing or is that wrong?

That is not a good assumption to make. While cargo apk and cargo ndk initially build an identical libagdk_winit_wgpu.so, cargo apk packages that up into an APK and installs it on the phone whereas the README clearly has more steps to build the Java counterpart of the app via gradle, and finally package the Rust library and Java counterpart into an APK to install it.

@MarijnS95 MarijnS95 transferred this issue from rust-mobile/android-activity Jul 12, 2023
@MarijnS95
Copy link
Member

Transferring this to the examples repo as it seems to be an issue with reading and executing the documentation/README rather than GameActivity itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants