Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashing and alan not waking on hey alan call #11

Closed
the-accidental-engineer opened this issue Mar 7, 2022 · 7 comments
Closed
Assignees

Comments

@the-accidental-engineer
Copy link

Error

E/AndroidRuntime(15726): FATAL EXCEPTION: main
E/AndroidRuntime(15726): Process: com.example.ai_radio, PID: 15726
E/AndroidRuntime(15726): java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to com.alan.alansdk.events.EventParsed$ParsedEntity
E/AndroidRuntime(15726): at com.alan.alansdk.button.AlanStateListener.onParsedEvent(:1)
E/AndroidRuntime(15726): at com.alan.alansdk.d.run(:6)
E/AndroidRuntime(15726): at android.os.Handler.handleCallback(Handler.java:790)
E/AndroidRuntime(15726): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(15726): at android.os.Looper.loop(Looper.java:192)
E/AndroidRuntime(15726): at android.app.ActivityThread.main(ActivityThread.java:6711)
E/AndroidRuntime(15726): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15726): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
E/AndroidRuntime(15726): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

script
AI_Radio_First_version_20211207_105241UTC.zip

repo link - https://github.com/Prateek0Srivastav/Radio-App if needed

code -

setUpAlan() {
AlanVoice.addButton(
"key/prod",
buttonAlign: AlanVoice.BUTTON_ALIGN_RIGHT);
AlanVoice.onCommand.add((command) {
debugPrint("got new command ${command.toString()}");
_handleCommand(command.data);
});
}

_handleCommand(Map<String, dynamic> response) {
switch (response["command"]) {
case "play":
_playMusic(_selectedRadio!.url);
break;

  case "play_channel":
    final id = response["id"];
    _audioPlayer.pause();
    MyRadio newRadio = radios!.firstWhere((element) => element.id == id);
    radios!.remove(newRadio);
    radios!.insert(0, newRadio);
    _playMusic(newRadio.url);
    break;

  case "stop":
    _audioPlayer.stop();
    break;

  case "next":
    final index = _selectedRadio!.id;
    MyRadio newRadio;
    if (index + 1 > radios!.length) {
      newRadio = radios!.firstWhere((element) => element.id == 1);
      radios!.remove(newRadio);
      radios!.insert(0, newRadio);
    } else {
      newRadio = radios!.firstWhere((element) => element.id == index + 1);
      radios!.remove(newRadio);
      radios!.insert(0, newRadio);
    }
    _playMusic(newRadio.url);
    break;

  case "prev":
    final index = _selectedRadio!.id;
    MyRadio newRadio;
    if (index - 1 <= 0) {
      newRadio =
          radios!.firstWhere((element) => element.id == radios!.length);
      radios!.remove(newRadio);
      radios!.insert(0, newRadio);
    } else {
      newRadio = radios!.firstWhere((element) => element.id == index - 1);
      radios!.remove(newRadio);
      radios!.insert(0, newRadio);
    }
    _playMusic(newRadio.url);
    break;

  default:
    print("Command was ${response["command"]}");
}

}

@snyuryev
Copy link
Contributor

snyuryev commented Mar 7, 2022

@Prateek0Srivastav I will take a look.

Could you provide steps with your script. What command is not working?

@the-accidental-engineer
Copy link
Author

As of now only play and pause command work and all other command may cause app crash with above mentioned error
get a clone of my repo and run flutter run --release and try play music.
hey alan also not waking up the assistant

@snyuryev snyuryev self-assigned this Mar 8, 2022
@snyuryev
Copy link
Contributor

snyuryev commented Mar 9, 2022

@Prateek0Srivastav Is it the same issue with debug build?

@the-accidental-engineer
Copy link
Author

@snyuryev no this happen in the release only.

@snyuryev
Copy link
Contributor

snyuryev commented Mar 9, 2022

@Prateek0Srivastav

Please try to add additional params for release build type

shrinkResources false
minifyEnabled false

to your build.gradle file. It should be located

[your_app_folder]/android/app/build.gradle

As result you should have something similar to:

buildTypes {
        release {
            signingConfig signingConfigs.debug
            shrinkResources false
            minifyEnabled false
        }
}

After that please try to run

@snyuryev
Copy link
Contributor

@Prateek0Srivastav

Also updated version on plugin (3.3.0) is available.
Please try this one.

@snyuryev
Copy link
Contributor

Fixed with previous release.
Please create a new issue if you need any additional help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants