-
Notifications
You must be signed in to change notification settings - Fork 278
Android libraries crashing on startup with given examples. #329
Comments
Confirmed I can repro, investigating... |
I have a workaround to unblock you, but I am puzzled how this ever worked before and is now broken, because we are still using the same branch as we were of
import android.view.WindowManager;
import android.os.Process;
+ import org.webrtc.ContextUtils;
public class UnityPlayerActivity extends Activity implements IUnityPlayerLifecycleEvents
{
protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code
// Override this in your custom UnityPlayerActivity to tweak the command line arguments passed to the Unity Android Player
// The command line arguments are passed as a string, separated by spaces
// UnityPlayerActivity calls this from 'onCreate'
// Supported: -force-gles20, -force-gles30, -force-gles31, -force-gles31aep, -force-gles32, -force-gles, -force-vulkan
// See https://docs.unity3d.com/Manual/CommandLineArguments.html
// @param cmdLine the current command line arguments, may be null
// @return the modified command line string or null
protected String updateUnityCommandLineArguments(String cmdLine)
{
return cmdLine;
}
// Setup activity layout
@Override protected void onCreate(Bundle savedInstanceState)
{
+ ContextUtils.initialize(getApplicationContext());
+
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState); |
Alright I'll give it a shot tomorrow, although it should be possible to include our own activity manifests & code into the unity build pipeline, if I happen to get it working by auto generating these fixes, would you want me to create a merge request? |
That would be great yes, thanks! I will continue to investigate how this broke and why it was working when we merged Android support a few weeks ago; I didn't change anything to my test setup, so I'd like to clarify this. |
I've confirmed after following the above instructions, I'm able to load the built unity project on android, however once I create the offer it crashes :( (Still using the standalonedemo scene) Does it work with a complete connection on your end?
|
It crashes for me as well, but not sure this is the same, today I am in a weird state were the app seems to be running (I can pause it with the debugger) but also seems completely unresponsive after starting to establish a connection. I am not sure if this is due to a bug or there's something wrong with my setup or Android Studio. Looking at your callstack, I recently changed the arguments to use a struct for ICE candidates. I bet there is once again an issue with marshaling that; this is a real pain between C# and IL2CPP not always doing things consistently. I had tried that change on IL2CPP on Windows, but maybe it doesn't work on Android. I will try to repro as soon as I am out of this weird debugger state. For now I can't get any crash but also cannot get any connection started nor any logging, which makes little sense. |
That's fine, if there is anything I can do to help, please let me know! |
Thanks, I just need a bit of time to debug. I found there's most likely a deadlock when creating the offer, which is why the app is in this weird semi-responsive state and rendering stops, as the main Unity app thread is blocked waiting, but the app itself is still running (albeit doing nothing). |
|
I root-caused the second item above, which is due to compiling |
I confirmed that downgrading to C++14 fixes the issue I found, and opened a PR (#340) to fix. I am still not sure this is the same thing you are hitting @HyperLethalVector though. And there's still a bug when the |
Hi!
|
@HyperLethalVector I worked some more on Android, and the error you have in the last post is an audio permission error: 2020-05-15 17:22:09.698 2110-10675/? E/ServiceUtilities: Request requires android.permission.RECORD_AUDIO
2020-05-15 17:22:09.698 2110-10675/? E/AudioPolicyIntefaceImpl: getInputForAttr permission denied: recording not allowed for uid 10162 pid 1711 This means either the Android.manifest does not contain the <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" /> I didn't investigate how to make that happen automatically, but it's likely the error you're getting. One way to prevent Unity to overwrite that manual change is to delete the comment toward the top of the XML file where it's written something about that, and Unity will leave that file alone when regenerating projects in subsequent builds, so you don't have to think anymore about it. |
Can I check with you if there's anything left on that issue? Did you try again with the latest library pull as you mentioned in your last comment, and is the issue with permissions fixed? I have been doing some Android testing on my side ahead of 2.0.0-preview.1 and had no issue with the prerelease packages, aside from the usual thing of being careful of android permissions if/when Unity regenerate the project and overwrite the manifest (which I think can be disabled in some of the latest versions by deleting a comment in that file). |
Hi, I haven't had the chance to do this yet, I'm hoping this weekend I will~ |
Yes. Available from GitHub Releases page or from the new UPM registry: |
Hi, I am trying to get the samples to run on Oculus Quest, my project settings are IL2CPP, net standard 2.0 and ARM64. The app crashes on startup. I have added the RECORD_AUDIO and CAMERA permissions. Any advice?
|
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The app not to crash
The text was updated successfully, but these errors were encountered: