UnityPlayer Native Crash - android

I am opening and closing activities containing a Unity Player view and eventually after opening and closing multiple times the app will crash with a native error:
/CRASH: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) etc.
When I convert the symbols I get this:
jni::Java_bitter_jnibridge_JNIBridge_00024InterfaceProxy_delete(_JNIEnv*, _jobject*, long long)
That line appears to be in here: https://github.com/bitter/android-jni-bridge/blob/master/Proxy.cpp so it is causing an error when a pointer is being deleted. I assume I haven't unloaded Unity correctly and that's the problem? Any help on how to properly unload Unity?? (I am currently using Application.Unload())
Does anyone know what this means?
p.s (I have a setup using some tutorials e.g https://forum.unity.com/threads/using-unity-android-in-a-sub-view.98315/ and https://medium.com/#davidbeloosesky/embedded-unity-within-android-app-7061f4f473a) so as all my code is too much to post, I'll just say I have an activity which initialises the UnityPlayer and then all of the necessary callbacks copied from UnityPlayerActivity there :))

Related

Why my Unity game in Android freezes when calling LoadScene?

The game freezes permanently when I try to load the next scene but when I load it with "Additive" mode it's loaded fine (using SceneManager.LoadScene("NextScene", LoadSceneMode.Additive)).
In editor everything works even with mode "Single", the problem only appears with Android.
I don't want to use the "Additive" mode because it loads the content of the new scene above the old one.
I try:
using "adb logcat" to see if any exception occurs but there are no exceptions.
load an empty scene as a new scene but the problem still appears.
load using SceneManager.LoadSceneAsync("NextScene") but the problem still appear.
load with "Additive" mode and after the next scene is loaded I try to Unload the old scene using SceneManager.UnloadScene("OldScene") but it freezes again.
So the problem appears when Unity try to unload the old scene.
(I use Unity 2018.4.10f1 LTS).
Thanks in advance for any help.
Try to delete the objects from the last scene
In for loop to see what object response for the error
I try to build the game with PC and I face the same problem.
I see what in the output_log.txt file in "C:/Users/.../AppData/Local/Temp/.../My game name/Crashes" and the first readable messages after the crash are like this:
"ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFEF20E5212)"
without any other errors or exceptions by my game,
so I try to test the game with an updated version of Unity (2018.4.10f1 --> 2018.4.20f1),
Abracadabra everything works fine with the new version!!
and the problem doesn't appear anymore!!
I think it was a memory management problem in Unity 2018.4.10f1 but I don't know why.

" bad argument #-1 to 'newImageRect' (Proxy expected, got nil) " - Lua, using Corona SDK

So I just started learning how to use the Corona SDK to create games. Making an asteroid-field shooting type game, and came across this error when trying to play the game.
(I know there is almost an exact replica of this question, but it has 0 answers and the only comment does not apply to me.)
This is the full error + stack trace:
19:21:16.393 ERROR: Runtime error
19:21:16.393 C:\Users\Some User\Documents\Corona Projects\StarExplorer\game.lua:87: bad argument #-1 to 'newImageRect' (Proxy expected, got nil)
19:21:16.393 stack traceback:
19:21:16.393 [C]: in function 'newImageRect'
19:21:16.393 C:\Users\Some User\Documents\Corona Projects\StarExplorer\game.lua:87: in function '_listener'
19:21:16.393 ?: in function <?:167>
19:21:16.393 ?: in function <?:169>
Here is a hastebin of the game.lua, and here is a hastebin of the menu.lua class, which switches the scene from menu to game.
I can tell as much as line 87 is causing the issue, and that something is wrong with the arguments for newImageRect, but apart from that I have no clue.
The game runs and plays perfectly on first run, but attempting to replay it causes the error.
The code which switches the scene in the menu file is on lines 13-17.
Any help is appreciated, sorry if I am being silly and missing something obvious.
Thanks!
EDIT: The error is caused when it attempts to remove the game.lua scene.
You are calling createAsteroid with a timer.performDelay. So, you need to cancel this timer when game scene is destroyed or hidden.
asteroidSpawnTimer = timer.performWithDelay( asteroidSpawnTime, createAsteroid, 0 )
Try this:
function scene:hide( event )
--[[...]]--
if ( phase == "will" ) then
timer.cancel( gameLoopTimer )
timer.cancel( asteroidSpawnTimer ) -- cancel it
--[[...]]--

Fatal signal 11 after trying to open a canvas with a textEdit and custom font

I have an android app (created with android studio) that displays thing ina canvas. One possibility is to insert a EditText with a custom font. I'm able to save this, and open this activity once. But, when I try to open it a secon time, it crashes my app with the error:
Fatal signal 11 (SIGSEGV), code 1, fault addr 0xb844fc48 in tid 16935 (FinalizerDaemon)
I also have an ExceptionHandler, but it can't get this crash. I have red many other topics, but never found anything like my problem. The fonts are on the right place I think. Otherwise they wouldn't be opened the first time,
Regards.

Simple Gesture App Crashing Android Studio

All Code: https://gist.github.com/anonymous/e11f533921aa4308e29d
I have been following Bucky's "Learn Android Dev". I wrote this code out originally myself, but when it crashed on startup I then copied Bucky's source code. I am using a tablet to run this app, but it crashes on both VM's and the tablet itself with the error
Unfortunately, <app name> has stopped
Any ideas?
To use the GestureDetectorCompat class , you need to create an instance of the GestureDetectorCompat for your View. Refer this documentation.
So the code will fail with null pointer and so you will get ANR at this.gestureDetector.onTouchEvent(event);
So in your onCreate method add following code, should solve your issue.
gestureDetector=new GestureDetectorCompat(this,this);
gestureDetector.setOnDoubleTapListener(this);

Why do I get a strange blank screen error with OpenGLes/Android/NDK?

I'm getting a very weird error ever since I have "ported" the spritebatch code from Nokia's site. It runs well as a desktop applcation emulated by POWERVR. But on Android I only get a blank screen (in fact its black.) This happens if I just try to display a image, but it doesn't crash.
Here is where comes the weird part comes in: if i put glGeterror(); in the update function it works fine! (slowly, but displays everything fine) and geterror code returns 0. I have no idea what is going on or how to debug it, as I'm new to OpenGL but everything looks correct in the source. I spitted geterrors all around the code but without any clue. I've attached my project if you want to take a look. You will need Visual Studio + vsandroid to compile.
apparently the problem is not on the sprite batch, but in the java code. I replaced for another one that uses surface view and no longer im getting this esotheric behavior.

Categories

Resources