title: Why does my app crash when helper class is instantiated?
body: <p>I'm building a Unity game that uses a native android library with one activity. This library includes bluetooth functionality from an sdk for which i created a Helper class that i can't instantiate or reference in any way in my MainActivity without the game crashing.</p>
  <p>I'm new to Kotlin and android studio and can't figure out how to fix this.</p>
  <p>Building &amp; running in android and unity works without any errors.
  Running an android native app set up in the same way like the android library, works flawless.</p>
  <p>But when running the game independantly on phone it crashes, this has been tested on multiple devices.</p>
  <p><strong>MainActivity snippet</strong></p>
  <pre><code>import com.X.unitylib.BluetoothDeviceHelper //this import is not used for some reason
  
      class MainActivity : UnityPlayerActivity ()/*, BluetoothDeviceHelper.Listener*/ {
      
              private lateinit var bluetoothDeviceHelper: BluetoothDeviceHelper // App runs with this
              //private var bluetoothDevices = emptyList&lt;BluetoothDeviceHelper.BluetoothDevice&gt;() //Doesn't run
              //private var connectedBluetoothDevice: BluetoothDeviceHelper.BluetoothDevice? = null //Doesn't run
          
              override fun onCreate(savedInstanceState: Bundle?) {
                  super.onCreate(savedInstanceState)
                  bluetoothDeviceHelper = BluetoothDeviceHelper(applicationContext) //App doesn't run with this uncommented
              }
          
             /* override fun onStart() {
                  super.onStart()
                  //bluetoothDeviceHelper.addListener(this)
                  bluetoothDeviceHelper.startScan()
              }*/
  
  **BluetoothDeviceHelper snippet**
  
      class BluetoothDeviceHelper(context: Context) : BLEDevice.Delegate&lt;BLEDevice&gt;, BLEManager.Delegate&lt;BLEObject&gt;
  </code></pre>
  <ul>
  <li><p>Edit: was able to fix a couple issues so i updated my initial description and replaced the outdated stack trace with the latest error.</p>
  </li>
  <li><p>Edit2: New error, on monday i'll try the steps described in the link below and once i get it working, i'll post an answer with all the steps i took for others that end up in the same fringe situation.</p>
  </li>
  </ul>
  <p><a href="https://stackoverflow.com/questions/49164218/kotlin-and-unity-development-error">Kotlin and Unity development error</a></p>
  <p><a href="https://i.stack.imgur.com/afAsS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/afAsS.jpg" alt="latestError" /></a></p>