florent37 / Flutter-AssetsAudioPlayer

Play simultaneously music/audio from assets/network/file directly from Flutter, compatible with android / ios / web / macos, displays notifications
https://pub.dartlang.org/packages/assets_audio_player
Apache License 2.0
757 stars 370 forks source link

Drawable not found #850

Open FahadIqbal opened 3 weeks ago

FahadIqbal commented 3 weeks ago

Flutter Version

My version :

Lib Version

My version :

Platform (Android / iOS / web) + version

Platform :

Describe the bug

.pub-cache/hosted/pub.dev/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:188:82 Unresolved reference: drawable

Small code to reproduce

import 'package:assets_audio_player/assets_audio_player.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State {

  final AssetsAudioPlayer _assetsAudioPlayer = AssetsAudioPlayer();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: RaisedButton(
            child: Text("open"),
            onPressed: () {
              //open code here
            }
          ),
        ),
      ),
    );
  }
}
FahadIqbal commented 3 weeks ago

even I added below tags in my main flutter project and in your project also i checked with empty project its same issue <meta-data android:name="assets.audio.player.notification.icon.play" android:resource="@drawable/ic_play_custom"/> <meta-data android:name="assets.audio.player.notification.icon.pause" android:resource="@drawable/ic_pause_custom"/> <meta-data android:name="assets.audio.player.notification.icon.stop" android:resource="@drawable/ic_stop_custom"/> <meta-data android:name="assets.audio.player.notification.icon.next" android:resource="@drawable/ic_next_custom"/> <meta-data android:name="assets.audio.player.notification.icon.prev" android:resource="@drawable/ic_prev_custom"/>

Supertommino commented 3 weeks ago

Same problem:

e: C:\Users\Tom\AppData\Local\Pub\Cache\hosted\pub.dev\assets_audio_player-3.1.1\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationService.kt: (168, 70): Unresolved reference: drawable
e: C:\Users\Tom\AppData\Local\Pub\Cache\hosted\pub.dev\assets_audio_player-3.1.1\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationService.kt: (172, 82): Unresolved reference: drawable
e: C:\Users\Tom\AppData\Local\Pub\Cache\hosted\pub.dev\assets_audio_player-3.1.1\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationService.kt: (176, 83): Unresolved reference: drawable
e: C:\Users\Tom\AppData\Local\Pub\Cache\hosted\pub.dev\assets_audio_player-3.1.1\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationService.kt: (180, 82): Unresolved reference: drawable
e: C:\Users\Tom\AppData\Local\Pub\Cache\hosted\pub.dev\assets_audio_player-3.1.1\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationService.kt: (184, 82): Unresolved reference: drawable
e: C:\Users\Tom\AppData\Local\Pub\Cache\hosted\pub.dev\assets_audio_player-3.1.1\android\src\main\kotlin\com\github\florent37\assets_audio_player\notification\NotificationService.kt: (188, 82): Unresolved reference: drawable
wangya123456789 commented 3 weeks ago

I had the same problem,

e: file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:168:70 Unresolved reference: drawable
e: file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:172:82 Unresolved reference: drawable
e: file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:176:83 Unresolved reference: drawable
e: file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:180:82 Unresolved reference: drawable
e: file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:184:82 Unresolved reference: drawable
e: file:///C:/Users/Admin/AppData/Local/Pub/Cache/hosted/pub.dev/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:188:82 Unresolved reference: drawable
Nuyoahhjh commented 3 weeks ago

e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:168:70 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:172:82 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:176:83 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:180:82 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:184:82 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:188:82 Unresolved reference: drawable

Nuyoahhjh commented 3 weeks ago

e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:168:70 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:172:82 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:176:83 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:180:82 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:184:82 Unresolved reference: drawable e: file:///D:/git/zerowait/bpm_player/plug/assets_audio_player-3.1.1/android/src/main/kotlin/com/github/florent37/assets_audio_player/notification/NotificationService.kt:188:82 Unresolved reference: drawable

private fun getSmallIcon(context: Context): Int {
    return android.R.drawable.ic_media_play
}

private fun getPlayIcon(context: Context, resourceName: String?): Int {
    return android.R.drawable.ic_media_play
}

private fun getPauseIcon(context: Context, resourceName: String?): Int {
    return android.R.drawable.ic_media_pause
}

private fun getNextIcon(context: Context, resourceName: String?): Int {
    return android.R.drawable.ic_media_next
}

private fun getPrevIcon(context: Context, resourceName: String?): Int {
    return android.R.drawable.ic_media_previous
}

private fun getStopIcon(context: Context, resourceName: String?): Int {
    return android.R.drawable.ic_media_pause
}Change to system icon temporary solution
rettet-die-stille commented 4 days ago

private fun getSmallIcon(context: Context): Int { return android.R.drawable.ic_media_play }

private fun getPlayIcon(context: Context, resourceName: String?): Int { return android.R.drawable.ic_media_play }

private fun getPauseIcon(context: Context, resourceName: String?): Int { return android.R.drawable.ic_media_pause }

private fun getNextIcon(context: Context, resourceName: String?): Int { return android.R.drawable.ic_media_next }

private fun getPrevIcon(context: Context, resourceName: String?): Int { return android.R.drawable.ic_media_previous }

private fun getStopIcon(context: Context, resourceName: String?): Int { return android.R.drawable.ic_media_pause }

wow! This works!! Thank you!!