xenko icon indicating copy to clipboard operation
xenko copied to clipboard

Android startup error

Open branc116 opened this issue 9 years ago • 22 comments

Hello!

First off, awesome engine!!

Now about the error.

I have loaded the basic sceen, nothing on it, just sphere, camera and the light. Didn't touch the code, it works on Widnows 10, but it doesn't work on android.

When I try to start the sceen on Android I get this error:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'SiliconStudio.Xenko.Audio.AudioEngine' threw an exception.

Stack trace isn't showing anything useful... : To see anything useful I need this file: Android.Views.ISurfaceHolder.cs , I presume it has something to do with Xamarin, but I can't find that file anywhere.

I get this for output: DebugLog.txt

Android OnCreate methode looks like this:

 protected override void OnCreate(Bundle bundle){
  base.OnCreate(bundle);
  Game = new Game();
  Game.Run(GameContext);
 }

When I set a breakpoint on the start of the OnCreate() methode, it hits and I can step over until I try to step over Game.Run(GameContext);, then I get the error.

I'm using:

  • Visual studio 2015
  • Xenko 1.8.1-beta
  • Physical device with 5.1 Android ( I tryed starting it on Emulated version from 4.4 - 6 but then I get the driver loading error, I don't think it has something to do with xenko)
  • Latest stable version of Xamarin

Hope you fix it soon.

And continue the great work :)

~Ričko

branc116 avatar Sep 09 '16 21:09 branc116

Looks like your device is an x86 device, is that correct?

sinkingsugar avatar Sep 12 '16 03:09 sinkingsugar

This is my hw, so no.. screenshot_2016-09-12-14-23-12

branc116 avatar Sep 12 '16 12:09 branc116

Xamarin version numbers? Make sure you are on a recent release please.

sinkingsugar avatar Sep 13 '16 01:09 sinkingsugar

Ah latest stable, sorry. Could you try alpha version of Xamarin ? I remember seeing this kind of message (x86 lib folders) at some point.

sinkingsugar avatar Sep 13 '16 01:09 sinkingsugar

Tryed it:

  • Updated Xamarin to latest Alpha.
  • Error1.txt
  • Installed Java 1.8.0_101
  • Installed JDK 8u101
  • Changed NDK folder to C:\Program Files\Android\android-ndk-r12b
  • Changed JDK folder to C:\Program Files\Java\jdk1.8.0_101
  • Changed JAVA_HOME to C:\Program Files\Java\jdk1.8.0_101
  • BuildLog1.txt
  • Changed Compile using Android Version from Nuget 7.0 to Lolipop 5.1
  • Changed Graphics Profile to Direct3D 10.0/OpenGL ES 3.0
  • Still Nothing
  • Created New Project
  • BuildLog2.txt
  • DebugLog1.txt
  • Back where I started...

It didn't work :(

If I may suggest something. This is adb to my device landsky.ddnsking.net:55555, so you can just enter adb connect landsky.ddnsking.net:55555 in cmd and debug on my device, so that you can see if the problem is in my environment or in my device.

branc116 avatar Sep 13 '16 03:09 branc116

We might have found something that could cause your issue: Please try to remove SiliconStudio.Core.Native.dll.config and SiliconStudio.Xenko.Native.dll.config from the Xenko installation folder ( something similar to C:\Program Files\Silicon Studio\Xenko\GamePackages\Xenko.1.8.0-beta\Bin\Android-OpenGLES ). And delete them as well from your game output folder ( or just create a new game for testing ) and compile. Let me know if this works.

sinkingsugar avatar Sep 13 '16 04:09 sinkingsugar

I have 1.8.1-beta installed and in 1.8.0-beta folder I only have Bin\Windows-Direct3D11 folder

  • Deleted "(InstallLoc)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES\SiliconStudio.Core.Native.dll"
  • Deleted "(InstallLoc)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES\SiliconStudio.Core.Native.dll.config"
  • Deleted "(NewProject)\Bin"
  • Deleted "(NewProject)\Obj"
  • Deleted "(NewProject)\NewXenkoTest2.Android\obj"
  • Build error: BuildLog1.txt

It's complaining about the files I deleted :(

branc116 avatar Sep 13 '16 05:09 branc116

Don't delete the .dll, just .dll.config please

sinkingsugar avatar Sep 13 '16 05:09 sinkingsugar

Also should be in Android-OpenGLES of the latest installed version, 1.8.1 in your case

sinkingsugar avatar Sep 13 '16 05:09 sinkingsugar

Sorry, I misread it...

I restored .dll but and deleted dll.config. Now it's building, but still getting the the original error.

branc116 avatar Sep 13 '16 05:09 branc116

Could you make sure you try with the files deleted on a new clean project?

sinkingsugar avatar Sep 13 '16 06:09 sinkingsugar

I did this:

  • Deleted SiliconStudio.Core.Native.dll.config
  • Deleted SiliconStudio.Xenko.Native.dll.config
  • Created new project inside of Xenko launcher
  • Opened the project in IDE
  • Build the project for Android
  • Build Succesful: BuildLog1.txt
  • Deployed to Device
  • On Android Device got error Unfortunately, NewXenkoTest3 has stopped
  • Inside Visual studio I didn't get any exeptions thrown, it just stopped debuging, with this DebugLog1.txt <- Stacktrace inside
  • Created Class1.txt that extends the SiliconStudio.Xenko.Engine.Game() class to see what breakpoints app will hit
  • It hit:
    • PrepareContext() - Didn't crash
    • OnWindowCreated() - Didn't crash
    • Initialize() - Did crash

I guess this is a step forward, it didn't crash in managed code, it crashed in native...

branc116 avatar Sep 13 '16 14:09 branc116

We are going to look at the crash.

In the meantime, could you restore the .dll.config files with the ones attached in the zip file and simply recompile your game and verify that they are indeed in the output folder of your game (Bin\Android\Debug). Let us know if you get the initial failure or the crash when running your game.

dll_configs.zip

manu-st avatar Sep 14 '16 00:09 manu-st

On it boss! This is what happened:

  • Repoend the project
  • Build, deploys, Internal unmanaged native error again
  • Restored new dll.config files
  • Build Successful with BuildLog2.txt
  • It didn't crash while running, but it was throwing errors on other threads, I think... Short vesion of the log:
  • Maybe useful things I noticed:
    • In MyGame class this is call order:

      • PrepareContext() - no error
      • OnWindowCreated() - no error
      • Initialize() - no error
      • BeginDraw() - Some errors, but no crash - BeginDrawError1.txt
      • BeginRun() - no error
      • LoadContent() - no error
      • BeginDraw() - no error
      • Draw() - error, but no crash - DrawError1.txt
      • BeginDraw() - no error
      • Draw() - error, but no crash - DrawError2.txt
      • Last two repeat forever with the same effect, as far as I can tell
    • It doesn't crash at any point

    • There are 10 active threads

    • This are the files you send:

      • SiliconStudio.Core.Native.dll.config
      <configuration>
        <dllmap dll="libcore" cpu="x86" target="x86/libcore.so"/>
        <dllmap dll="libcore" cpu="x86-64" target="x64/libcore.so"/>
      </configuration>
      
      • SiliconStudio.Xenko.Native.dll.config
      <configuration>
        <dllmap dll="libxenko" cpu="x86" target="x86/libxenko.so"/>
        <dllmap dll="libxenko" cpu="x86-64" target="x64/libxenko.so"/>
      </configuration>
      
    • This are the files I deleted:

      • SiliconStudio.Core.Native.dll.config
      <configuration>
        <dllmap dll="libcore" wordsize="32" target="x86/libcore.so"/>
        <dllmap dll="libcore" wordsize="64" target="x64/libcore.so"/>
      </configuration>
      
      • SiliconStudio.Xenko.Native.dll.config
      <configuration>
        <dllmap dll="libxenko" wordsize="32" target="x86/libxenko.so"/>
        <dllmap dll="libxenko" wordsize="64" target="x64/libxenko.so"/>
      </configuration>
      
    • If I replace your new dll.configs with old dll.configs and delete Bin and Obj folder I get the original error.

    • After Building, Deleting Bin\Android\Debug folder a few times I can verify that there are no dll.config files in that folder

    • I swaped the dll.config files a few times and every time I got the expected error

    • If I put new dll.configs in Bin\Android\Debug folder I get native internal unmanaged error, and game crashes

    • If I then remove it it's back to endless loop of Draw errors

Another step forward, yey :)

branc116 avatar Sep 14 '16 02:09 branc116

Thanks for the detailed report! Could you clarify that:

  • If you put the new .dll.config files, you get the crash in the unmanaged part (when setting up the Audio)
  • If you remove the .dll.config files, it goes further and infinitely loop in the drawing

?

If the second statement is true, it is strange that yesterday it was crashing in the Audio part as you also did not have the .dll.config files.

Let's see about the infinite error with finding the frame buffer. Could you install the OpenGL extension viewer app (https://play.google.com/store/apps/details?id=com.realtechvr.glview&hl=en) and provide us with the detailed on your version of OpenGL used on this Android device?

manu-st avatar Sep 14 '16 03:09 manu-st

These are the cases:

  • if there are new dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and there aren't any dll.configs in (TestProjectFolder)\Bin\Android\Debug then I get infinite loop of drawing error
  • if there are new dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and new dll.configs in (TestProjectFolder)\Bin\Android\Debug then I get unmanaged error
  • if there are new dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and old dll.configs in (TestProjectFolder)\Bin\Android\Debug - didn't test this case.
  • if there are old dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and there aren't any dll.configs in (TestProjectFolder)\Bin\Android\Debug then I get original error
  • if there are old dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and new dll.configs in (TestProjectFolder)\Bin\Android\Debug - didn't test this case
  • if there are old dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and old dll.configs in (TestProjectFolder)\Bin\Android\Debug - didn't test this case
  • if thete aren't any dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and there aren't any dll.configs in (TestProjectFolder)\Bin\Android\Debug then I get the unmanaged error
  • if thete aren't any dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and new dll.configs in (TestProjectFolder)\Bin\Android\Debug - didn't test this case
  • if thete aren't any dll.configs in (XenkoInstallFolder)\Silicon Studio\Xenko\GamePackages\Xenko.1.8.1-beta\Bin\Android-OpenGLES and old dll.configs in (TestProjectFolder)\Bin\Android\Debug - didn't test this case

Or this:

  • new + no = inf loop
  • new + old = null
  • new + new = unmannaged
  • old + no = original
  • old + old = null
  • old + new = null
  • no + no = unmannaged
  • no + old = null
  • no + new = null

If you think there is need for testing the cases I didn't test, let me know and I'll do my best. And for the app, I installed it, but I'm not sure what do You what me to do with it.

branc116 avatar Sep 14 '16 03:09 branc116

For the App, if you could extract all the information on the OpenGL version that would be great.

manu-st avatar Sep 14 '16 04:09 manu-st

Not sure if You wanted this, but it's the only thing I can find: glview-Mali-T720_Android_22.xml.txt

branc116 avatar Sep 14 '16 04:09 branc116

In the scenario of drawing error could you try to run a project that is no more then profile 9.3?

sinkingsugar avatar Sep 15 '16 06:09 sinkingsugar

Sorry for the delay... This are results:

Table of errors:

Graphics profile Error Debug log Loops Draw methode
9.1 New error DebugLog9.1.txt Yes
9.2 Same as 9.1 DebugLog9.2.txt Yes
9.3 Same as 9.1 DebugLog9.3.txt Yes
10.0 Original inf loop error DebugLog10.0.txt Yes
10.1 Same as 10.0 DebugLog10.1.txt Yes
11.0 Same as 10.0 DebugLog11.0.txt Yes
11.1 Not supported DebugLog11.1.txt No
11.2 Not supported DebugLog11.2.txt No

I see now why You only wanted the 9.3... But I tested every profile anyway.

branc116 avatar Sep 17 '16 01:09 branc116

Hello!

I don't know if you are still working on this problem, I hope you are...

Anyway I was testing base project on diferent devices, and I managed to make it work on redme note 2, so It's not my enviement that is misbehaving, it's my phone and xenko...

And I managed to take a OpenGl log of redme note, this are results:

Phone OpenGlLog Works
Redme note 2 WorkingGL.txt Yes
Acer NotWorkingGL1.txt No
Some Qualcomm phone NotWorkingGL2.txt No

Dif (Working\Notworking): WorkingMinusNotWorking.txt

It's interesting that phones that can't run the app don't have GL_IMG_* files and the phone that can run the app, has.

Hope it helps :)

branc116 avatar Oct 15 '16 21:10 branc116

Hi, i dont know if this was ever resolved but i seem to be having the same error of "The type initializer for 'SiliconStudio.Xenko.Audio.AudioEngine' threw an exception."

This error is only happening when i run the app on android with CPU architecture arm64-v8a, all other architectures work. Im currently using xenko 1.10.2 beta but i even tried the audio example in xenko 2.1.1.1 and there was the same problem.

Please help

Simba-Mupfunya avatar Jan 22 '18 11:01 Simba-Mupfunya