londonappbrewery / xylophone-flutter

Starter code for the Xylophone project in the Complete Flutter Bootcamp
https://www.appbrewery.co
116 stars 886 forks source link

The plugin `audioplayers` requires your app to be migrated to the Android embedding v2. #32

Open aadilvarshani opened 3 years ago

aadilvarshani commented 3 years ago

The plugin is outdated

shivansh3345 commented 3 years ago

the plugin is not outdated the project is , it was created before version 1.12. It's better to create a new project and then import the assets and other files like app icons etc because migrating it to android embedding v2 is a very tedious job.

Parthosh123 commented 3 years ago

the plugin is not outdated the project is , it was created before version 1.12. It's better to create a new project and then import the assets and other files like app icons etc because migrating it to android embedding v2 is a very tedious job.

but i still got issues can you please share your code bro!!

shivansh3345 commented 3 years ago

the plugin is not outdated the project is , it was created before version 1.12. It's better to create a new project and then import the assets and other files like app icons etc because migrating it to android embedding v2 is a very tedious job.

but i still got issues can you please share your code bro!!

ok so first step is to clone this repository, then just create a new flutter project from scratch, then create a directory named assets in your flutter project folder, then go to the folder where you cloned this repo and go to assets folder and copy the audio files and then paste it in the assets folder in your flutter project. now the next step is icons, go to the folder of this repo then go to the location android>app>src>main>res and copy all the folders starting with mipmap AND also the folder called 'drawable', then go to the same folder in your flutter project((i.e) res folder) and paste it there(paste and replace). Now after all the copy pasting is done, edit the pubspec.yaml file and add the assets folder in the section 'assets' and then run 'pub get' to get the dependencies. that should do it. if you're still getting errors then add the error message in your comment and I'll try and help as much as I can. I have attached the screenshot of pubspec.yaml file for reference. hope this helps. Screenshot from 2021-05-18 15-35-50

jmrchelani commented 3 years ago

This is because of the project, it is outdated and is not according to the flutter android embdding v2. Follow this link to find fix: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

alwaysaditi commented 3 years ago

the plugin is not outdated the project is , it was created before version 1.12. It's better to create a new project and then import the assets and other files like app icons etc because migrating it to android embedding v2 is a very tedious job.

but i still got issues can you please share your code bro!!

ok so first step is to clone this repository, then just create a new flutter project from scratch, then create a directory named assets in your flutter project folder, then go to the folder where you cloned this repo and go to assets folder and copy the audio files and then paste it in the assets folder in your flutter project. now the next step is icons, go to the folder of this repo then go to the location android>app>src>main>res and copy all the folders starting with mipmap AND also the folder called 'drawable', then go to the same folder in your flutter project((i.e) res folder) and paste it there(paste and replace). Now after all the copy pasting is done, edit the pubspec.yaml file and add the assets folder in the section 'assets' and then run 'pub get' to get the dependencies. that should do it. if you're still getting errors then add the error message in your comment and I'll try and help as much as I can. I have attached the screenshot of pubspec.yaml file for reference. hope this helps. Screenshot from 2021-05-18 15-35-50

Thank you so much ! This worked for me. Additionally , I also had to change another link in gradle-wrapper.properties on the new flutter project. It seems the url of the distribution link was written as https \://services.gradle.org/distributions/gradle-6.7.1-all.zip , so it was unable to unzip some files. Correcting the url to https://services.gradle.org/distributions/gradle-6.7.1-all.zip and upgrading the kotlin version to the latest version in build.gradle solved the issue for me. Also , just in case anyone's facing an issue with audiocache import statement , like I did , I removed the audiocache import statement and let import 'package:audioplayers/audioplayers.dart'; be there . This line automatically imports audiocache as well to play local sounds from your system. Just putting it out here for anyone who needs it.

GibJaf commented 3 years ago

Updating line 2 of android/gradle/build.gradle file to ext.kotlin_version = '1.4.32' worked for me. Just in case it helps anyone out there

khyatigupta369 commented 3 years ago

Kindly visit this link for any migration related issues here. Helped me too, like for this project I just used the shortcut of recreating it. But the issue is resolved here.

AkshaySiddannavar commented 2 years ago

Just a step by step Solution :

Step 1 : Create a new flutter project at your local system

Step 2 : Copy the code given in 'main.dart' file of stub project and paste it into 'main.dart' file of your local project

Step 3 : Make an 'assets' folder in your local project

Step 4 : download sound-files from github and put them into your local 'assets' folder

Step 5 : in your local pubspec.yaml file, add dependency for your 'assets' folder

Step 6 : Rename 'MyApp()' in widget testing file to 'MaterialApp()'

Hit save(in files other than pubspec.yaml), get all dependencies(in pubspec.yaml) and you're good to go

Note : This won't give an AppIcon though it will be enough to get you started

joejills commented 1 year ago

There is an issue with the audioplayers package. I personally tried every single release for the package and searched through all the forums. At last, I have found how to make this package work with the project.

Head over to my repository where I have made it all work.

Hi,

You commented 24 hours ago, but your pubspecYAML is out of date.

joejills commented 1 year ago

There is an issue with the audioplayers package. I personally tried every single release for the package and searched through all the forums. At last, I have found how to make this package work with the project.

Head over to my repository where I have made it all work.

You are also using a version of audioplayers that was superseded months ago...

why bother uploading something that is so out of date.