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

Drawable not found #850

Open
FahadIqbal opened this issue Oct 26, 2024 · 7 comments
Open

Drawable not found #850

FahadIqbal opened this issue Oct 26, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@FahadIqbal
Copy link

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 FahadIqbal added the bug Something isn't working label Oct 26, 2024
@FahadIqbal
Copy link
Author

even I added below tags in my main flutter project and in your project also i checked with empty project its same issue




@Supertommino
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

rettet-die-stille commented Nov 18, 2024

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!!

@Rupakpoddar
Copy link
Contributor

Note: This change will not work for Flutter web platforms.

Try changing the following in pubspec.yaml:

Before:

dependencies:
  assets_audio_player: ^3.1.1

After:

dependencies:
  assets_audio_player:
    git:
      url: https://github.com/Rupakpoddar/Flutter-AssetsAudioPlayer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants