Ml-agents: Issue with TensorFlowSharp.Android.dll and Unity 2018.2.0f2

Created on 14 Jul 2018  路  16Comments  路  Source: Unity-Technologies/ml-agents

I just upgraded our project to 2018.2.0f2 and now our project is getting the error "Unloading broken assembly Assets/ML-Agents/Plugins/Android/TensorFlowSharp.Android.dll, this assembly can cause crashes in the runtime".

image

We're not building for Android, so this doesn't impact our project - I just wanted to send it your way in case you were not aware. (A quick search in the issue tracker did not yield anything.)

bug

Most helpful comment

Any news? Still getting those errors on Unity 2018.2.3f1

All 16 comments

I think it's an import setting problem. Just select the TensorFlowSharp.Android.dll and uncheck Editor as platform for this plugin (and everything else but Android). This makes the error go away.

I haven't tested Android builds though.

Unchecking "Editor" won't let you run the game in the editor when the target platform is Android. Yet, you can't run the game in the editor either due to the .dll not being loaded. Unchecking "Editor" makes the error message to disappear, but it doesn't fix the problem.
The Android build works fine even with the error message ""Unloading broken assembly..."

Yeah, the game won't compile after unchecking "Editor" but build works fine with the unloading error message. This also happens on Unity 2017.4.7f1.

Any news? Still getting those errors on Unity 2018.2.3f1

This error still exists in Unity 2018.2.4f1

@xiaomaogy

Can we get an update on the status of this issue?

Hi @EstonianGiant @manugomez95 @zkwencu @jjjuande so unchecking the Editor doesn't work. However the error message is just annoying but doesn't influence anything.

When you switch to some platform that is not Android, keep the TensorFlowSharp.Android.dll's Editor option checked will work. The error message is there saying:"Unloading broken assembly Assets/ML-Agents/Plugins/Android/TensorFlowSharp.Android.dll, this assembly can cause crashes in the runtime", but you can still do everything normally, and you can ignore it.

When you switch to Android platform, still keep the TensorFlowSharp.Android.dll's Editor option checked. When you click "play" in the editor with internal brain selected, it will show one additional error message like

TypeLoadException: Could not find method due to a type load error
MLAgents.Brain.InitializeBrain (MLAgents.Academy aca, MLAgents.Batcher brainBatcher) (at Assets/ML-Agents/Scripts/Brain.cs:211)
MLAgents.Academy.InitializeEnvironment () (at Assets/ML-Agents/Scripts/Academy.cs:288)
MLAgents.Academy.Awake () (at Assets/ML-Agents/Scripts/Academy.cs:227)

And it won't do the inference correctly, but that's fine because when you build the APK for the Android platform, it can still work correctly in the Android Studio emulator.

So as a conclusion, this is just something really annoying (the error message), but it can still work. We are still not sure why the Unity version change causes this error message to pop up, and are still investigating on this, but hopefully this is not blocking anyone.

Thanks for the update @xiaomaogy.

The inference not working on an Android platform actually is the blocker for me. (I want to use inference on my android device, not be stuck just using Android Studio emulator).

@EstonianGiant So the inference is working for you on the Android Studio emulator but not on the actual Android device?

@xiaomaogy. Any update on this issue ? I've been trying for days and im getting the same 'Unloading broken assembly Assets/ML-Agents/Plugins/Android/TensorFlowSharp.Android.dll, this assembly can cause crashes in the runtime' error .
I cannot build it to my android device ..also is there any chance where the whole plugin get updated to TF 1.9 or 1.10

@skywalker78 Have you tried the steps I mentioned here (https://github.com/Unity-Technologies/ml-agents/issues/979#issuecomment-416414831)? I've tested on a real Android device (a Samsung s9), and it works.

Regarding upgrading to TF 1.0 to 1.10, we don't have plan for that in the near future, because the TFSharp Android project we rely on isn't upgrade to that version yet.

@EstonianGiant The inference is working on Android platform following the steps I listed. If following these steps doesn't work for you, please tell me what error message you get and which step you are stuck on.

Since the bug is fixed in v0.5, I'm closing this issue.

@xiaomaogy is there work object detection in android phone?

No there is none. @jaydipsinh0738

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkTension picture MarkTension  路  3Comments

Sohojoe picture Sohojoe  路  3Comments

scotthovestadt picture scotthovestadt  路  4Comments

jlanis picture jlanis  路  4Comments

dlindmark picture dlindmark  路  3Comments