Search Issue Tracker

Fixed in 5.6.0f3

Fixed in 5.5.X, 5.6.X

Votes

234

Found in

5.5.0f3

Issue ID

856773

Regression

Yes

[Android] Location app crashes due to error 'jstring has wrong type: android.location.Location'

Mobile

-

How to reproduce:
1. Open the attached project
2. Build and Run Test scene on Android device (it has only one line Input.location.Start() in script)
3. When app launches, select "Allow" in the permission dialog
4. App will start and location service will start to initialize
5. Notice that app will crash in several second after beginning of location init

Reproducible: 5.5.0f1, 5.5.0f3, 5.6.0a5
Not reproducible: 5.5.0b11

Issue is not device specific

Comments (115)

  1. Emperor

    Jan 19, 2017 18:54

    Guys, I can confirm that the plugin that H-ALEX made now works. I suggest you get it while we wait for Unity: http://1sh.eu/

    Thanks again!

  2. H-Alex

    Jan 19, 2017 18:44

    @EMPEROR : I looked at your files and I guess the problem was due to the faulty directory structure I made to store the jar file. Please try the new unitypackage and give us your feedback. Cheers.

  3. H-Alex

    Jan 19, 2017 16:11

    @EMPEROR : please continue this talk via email, and send me your empty projet with plugin not working zipped. Cheers.

  4. Emperor

    Jan 19, 2017 16:06

    Thanks for the reply and your time @H-ALEX. I made a new project with just the plugin but I still get an error when running the sample. I've ran it on an android emulator(genymotion) and on a xperia z2 but both display the error below.

    I/Unity (13716): NullReferenceException: Object reference not set to an instance of an object
    I/Unity (13716): at SingleShadePlugin.LocationOverride.GetLocation () [0x00000] in <filename unknown>:0
    I/Unity (13716): at SingleShadePlugin.InputLocation.FillWithData () [0x00000] in <filename unknown>:0
    I/Unity (13716): at SingleShadePlugin.InputLocation.get_lastData () [0x00000] in <filename unknown>:0
    I/Unity (13716): at SampleUse.OnGUI () [0x00000] in <filename unknown>:0
    I/Unity (13716):
    I/Unity (13716): (Filename: Line: -1)

  5. H-Alex

    Jan 19, 2017 13:07

    @SIMONALKEMADE2 the plugin is android only because this issue is android only. I've not experienced a similar bug with iOS.

  6. H-Alex

    Jan 19, 2017 13:07

    Hello @EMPEROR, I don't see exactly why you have this error. Just to let you know that you cannot call directly LocationOverride, please use InputLocation instead. Also you have to keep the original directory structure of the plugin. And finally you don't have to add a manifest at all, Unity does it automatically because of line 45 of LocationOverride.cs (which is never called, and here to trick Unity to let him think we're using GPS code).

    If you have a custom manifest, you'll need :
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <!-- Needed only if your app targets Android 5.0 (API level 21) or higher. -->
    <uses-feature android:name="android.hardware.location.gps" />

    Please send me an email at the adress on the webpage with your sources if I can help.
    Also please test the plugin in an empty project before to confirm and narrow your problem down.

  7. wangxiao

    Jan 19, 2017 03:14

    Unity 5.5.0p4 (64-bit) got this issue too

  8. Emperor

    Jan 18, 2017 21:08

    H-ALEX thank you for the plugin. I get a Null reference exception at locationoverride.cs line 62 when running the sample. I'm thinking my manifest file I created is wrong; would you mind sharing the manifest that you use?

  9. SimonAlkemade2

    Jan 18, 2017 17:12

    H-ALEX thank you for the android workaround but I just tested it on iOS and it seems it doesn't find GPS on iOS as well so iOS needs to be fixed as well. My Objective-C sucks so I will try to look into it but don't expect too much.

  10. ASPePeX

    Jan 18, 2017 13:16

    Still broken in 5.6.0b4.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.