Android 如果我们在Flatter应用程序中发布内置版本,则自定义声音不起作用

Android 如果我们在Flatter应用程序中发布内置版本,则自定义声音不起作用,android,flutter,Android,Flutter,在调试模式下,一切都正常工作,如果我运行,flutter run——release。 但如果我生成发布版本并使用它运行,自定义声音就不起作用了。 我用的是颤振 这是密码 Future _showNotificationWithSound(title, message) async { var vibrationPattern = Int64List(4); vibrationPattern[0] = 0; vibrationPattern[1] = 1000; v

在调试模式下,一切都正常工作,如果我运行,flutter run——release。 但如果我生成发布版本并使用它运行,自定义声音就不起作用了。 我用的是颤振

这是密码

Future _showNotificationWithSound(title, message) async {
    var vibrationPattern = Int64List(4);
    vibrationPattern[0] = 0;
    vibrationPattern[1] = 1000;
    vibrationPattern[2] = 5000;
    vibrationPattern[3] = 2000;

    var androidPlatformChannelSpecifics = AndroidNotificationDetails(
        'added_my_channel_id',
        'abc',
        'abc',
        icon: 'app_icon',
        playSound: true,
        sound: RawResourceAndroidNotificationSound('notifiysound'),
        vibrationPattern: vibrationPattern,
        enableLights: true,
        color: const Color.fromARGB(255, 255, 0, 0),
        ledColor: const Color.fromARGB(255, 255, 0, 0),
        ledOnMs: 1000,
        ledOffMs: 500);

    var iOSPlatformChannelSpecifics =
    IOSNotificationDetails(sound: 'notifiysound.mp3');
    var platformChannelSpecifics = NotificationDetails(
        androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
    flutterLocalNotificationsPlugin. show(
        0, title, message,platformChannelSpecifics);
  }

您可能在原始文件夹中缺少keep.xml。然后,这些文件将不包含在生成中,但仅在调试模式下运行时可用。请参阅此处的最后一个答案:

原始文件夹中可能缺少keep.xml。然后,这些文件将不包含在生成中,但仅在调试模式下运行时可用。请参阅此处的最后一个答案:

您最终找到了解决方案吗?没有@amucunguzi,还没有。这仍然是默认的声音。你最终找到了解决方案吗?没有@amucunguzi,还没有。这仍然是默认的声音。