I'm experiencing this error whenever I try to run the code after trying to add "assestsAudioplayer" to my code
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':assets_audio_player:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 14m 14s
Exception: Gradle task assembleDebug failed with exit code 1
I'll display the lines of code added that brought about the error and what dart file they were on
final assetsAudioPlayer = AssetsAudioPlayer();
my configMaps.dart file
void retrieveRideRequestInfo(String rideRequestId, BuildContext context)
{
newRequestsRef.child(rideRequestId).once().then((DataSnapshot dataSnapShot)
{
if(dataSnapShot.value != null)
{
assetsAudioPlayer.open(Audio("sounds/alert.mp3"));
assetsAudioPlayer.play();
double pickUpLocationLat = double.parse(dataSnapShot.value['pickup']['latitude'].toString());
double pickUpLocationLng = double.parse(dataSnapShot.value['pickup']['longitude'].toString());
String pickUpAddress = (dataSnapShot.value['pickup_address'].toString());
double dropOffLocationLat = double.parse(dataSnapShot.value['dropOff']['latitude'].toString());
double dropOffLocationLng = double.parse(dataSnapShot.value['dropOff']['longitude'].toString());
String dropOffAddress = (dataSnapShot.value['dropOff_address'].toString());
String paymentMethod = dataSnapShot.value['payment_method'].toString();
RideDetails rideDetails = RideDetails();
rideDetails.ride_request_id = rideRequestId;
rideDetails.pickup_address = pickUpAddress;
rideDetails.dropOff_address = dropOffAddress;
rideDetails.pickup = LatLng(pickUpLocationLat, pickUpLocationLng);
rideDetails.dropOff = LatLng(dropOffLocationLat, dropOffLocationLng);
rideDetails.payment_method = paymentMethod;
print("Information :: ");
print(rideDetails.pickup_address);
print(rideDetails.dropOff_address);
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) => NotificationDialog(rideDetails: rideDetails,),
);
}
});
}
The code above is part of my pushNotificationService.dart file,
and this is a block of code from my notificationDialog.dart file
Padding(
padding: EdgeInsets.all(20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: Colors.red)),
color: Colors.white,
textColor: Colors.red,
padding: EdgeInsets.all(8.0),
onPressed: ()
{
assetsAudioPlayer.stop();
Navigator.pop(context);
},
child: Text(
"Cancel".toUpperCase(),
style: TextStyle(
fontSize: 14.0,
),
),
),
SizedBox(width: 20.0),
RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: Colors.green)),
onPressed: ()
{
assetsAudioPlayer.stop();
},
color: Colors.green,
textColor: Colors.white,
padding: EdgeInsets.all(8.0),
child: Text("Accept".toUpperCase(),
style: TextStyle(fontSize: 14.0,)),
),
],
),
),
I also added provided the dependency in the pubspec.yaml file
assets_audio_player: ^2.0.13+1
Not sure what may be causing the error but I hoping for some assistance. Thank you in advance.
question from:
https://stackoverflow.com/questions/65903125/execution-failed-for-task-assets-audio-playercompiledebugkotlin