JoshLmao / Spotify4Unity

🎮🎵 Add the SpotifyAPI.NET library into Unity, enabling access to the Spotify Web API, allowing for control of Spotify and accessing the world of music
https://assetstore.unity.com/packages/tools/integration/spotify4unity-ui-tools-spotify-authorization-129028
MIT License
97 stars 8 forks source link

[Help] Error trying to set Android Implicit Auth variables #8

Closed timendez closed 5 years ago

timendez commented 5 years ago

I saw the latest release to v1.3.1 so I updated from the Unity asset store (it only updated the demo scene, AndroidScene, is this correct?) and I'm trying to get it to work.

I have the Android Spotify Service script added in my scene. However, it doesn't take in the client secret, whereas the PC auth script has it - maybe this is the issue?

Screen Shot 2019-04-22 at 1 39 26 PM

Screenshot for showing this only - mine is just the Android Spotify Service, but filled out.

Anyways I'm getting this error after I build and try loading my scene on my device:

Spotify4Unity - Error trying to set Android Implicit Auth variables - UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.originate.visualizer
  at UnityEngine.AndroidJNISafe.CheckException () [0x00091] in <817231eab2264cc79aa3cc5f137fe3fe>:0 
  at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00011] in <817231eab2264cc79aa3cc5f137fe3fe>:0 
  at UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) [0x002d6] in <817231eab2264cc79aa3cc5f137fe3fe>:0 
  at UnityEngine.AndroidJavaObject.CallStatic[ReturnType] (System.String methodName, System.Object[] args) [0x00001] in <817231eab2264cc79aa3cc5f137fe3fe>:0 
  at UnityEngine.AndroidJavaObject.FindClass (System.String name) [0x0001d] in <817231eab2264cc79aa3cc5f137fe3fe>:0
  at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00012] in <817231eab2264cc79aa3cc5f137fe3fe>:0 
  at UnityEngine.

NullReferenceException: Object reference not set to an instance of an object
  at ConnectToSpotify.Start () [0x00006] in <b44807fb8c734ccba23ddd9cd85cd7ac>:0

Here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.originate.visualizer" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <application android:icon="@mipmap/app_icon" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner" android:theme="@style/VrActivityTheme">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false" android:resizeableActivity="false">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
        <category android:name="com.google.intent.category.CARDBOARD" />
        <category android:name="com.google.intent.category.DAYDREAM" />
      </intent-filter>
      <!-- Intent to open the application normally -->
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <!-- Intent to open the app through a scheme-->
      <intent-filter>
        <!-- Enter your scheme here, must be all lower case-->
        <data android:scheme="visualizerscheme" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="com.google.android.vr.icon" android:resource="@drawable/vr_icon_front" />
      <meta-data android:name="com.google.android.vr.icon_background" android:resource="@drawable/vr_icon_back" />
    </activity>
    <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" />
    <meta-data android:name="unity.build-id" android:value="8e3a102b-7b5f-4c53-a360-8c308e5ab30e" />
    <meta-data android:name="unity.splash-mode" android:value="0" />
    <meta-data android:name="unity.splash-enable" android:value="False" />
  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-feature android:name="android.hardware.vr.headtracking" android:required="false" android:version="1" />
  <uses-feature android:name="android.software.vr.mode" android:required="false" />
  <uses-feature android:name="android.hardware.vr.high_performance" android:required="false" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.RECORD_AUDIO" />
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
  <uses-feature android:name="android.hardware.microphone" android:required="false" />
  <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>

Here is my Android Spotify Service:

Screen Shot 2019-04-22 at 1 59 51 PM

Is there anything I'm missing here? Thanks for your help!

JoshLmao commented 5 years ago

Ah, so the version on the Asset Store hasn't been updated as of yet! I like to update this repo and the documentation as I have completed the work however I'll make a release when it's live on the Asset Store from now on.

I submitted the update like 12 hours ago and should be live on the store within the next 24-48 hours (hopefully). And FYI, If you want to check which version of Spotify4Unity you are using, check the ReadMe.txt file. I add the version there.

The Android Service doesn't require a secret id because it has a different way of authenticating with Spotify. Check out the Wiki page for more info

timendez commented 5 years ago

Great, thank you!