ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Issue with TensorFlowSharp.Android.dll and Unity 2018.2.0f2

Open Yecats opened this issue 8 years ago • 16 comments

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.)

Yecats avatar Jul 14 '18 14:07 Yecats

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.

Saduras avatar Jul 14 '18 14:07 Saduras

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..."

jjjuande avatar Jul 16 '18 07:07 jjjuande

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.

zkwencu avatar Jul 19 '18 21:07 zkwencu

Any news? Still getting those errors on Unity 2018.2.3f1

manugomez95 avatar Aug 12 '18 09:08 manugomez95

This error still exists in Unity 2018.2.4f1

EstonianGiant avatar Aug 19 '18 21:08 EstonianGiant

@xiaomaogy

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

EstonianGiant avatar Aug 27 '18 16:08 EstonianGiant

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.

xiaomaogy avatar Aug 28 '18 00:08 xiaomaogy

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 avatar Aug 28 '18 02:08 EstonianGiant

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

xiaomaogy avatar Aug 28 '18 17:08 xiaomaogy

@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 avatar Aug 29 '18 19:08 skywalker78

@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.

xiaomaogy avatar Sep 05 '18 20:09 xiaomaogy

@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.

xiaomaogy avatar Sep 05 '18 20:09 xiaomaogy

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

xiaomaogy avatar Dec 11 '18 01:12 xiaomaogy

@xiaomaogy is there work object detection in android phone?

jaydipsinh0738 avatar Jan 20 '19 10:01 jaydipsinh0738

No there is none. @jaydipsinh0738

xiaomaogy avatar Jan 21 '19 06:01 xiaomaogy

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.

lock[bot] avatar Jan 22 '20 22:01 lock[bot]