Flutter bluetooth.It doesn't give me real devices - flutter

Hi everybody I'm trying to use flutter_blue in my app.For this ı use this github project.https://github.com/pauldemarco/flutter_blue/blob/master/example/lib/widgets.dart. However when ı run this in my emulator it gives me 2 devices which are gDevice-beacon it didn't give me real devices.How can ı solve this.

You must run your app in your real phone.How can you think your emulator can show real device when your turn on bluetooth :).

Try this in build.gradle file in app:
buildTypes {
release {
signingConfig signingConfigs.release
shrinkResources false // this line
minifyEnabled false // this line
}
}
You can also try building the apk by :
flutter build apk --no-shrink

Related

Flutter android alarm manager plus not working in release version

I am fetching notifications from api in background using android alarm manager plus & is working fine in debug mode but not in release version.
I am using redmi note 7.
According to flutter doctor all is fine.
I ran into a same problem recently, couldn't really find help anywhere. I tried fixing it with help from this similar issue, but it didn't work for me (could've been doing something wrong). However, I found a temporary fix.
Running from cli (temporary fix)
If you are running the app from cli, use --profile flag instead.
flutter run --profile
Building an apk (temporary fix)
If you are building an apk, change the config to build the apk in profile mode and then sign the apk as if it was in release mode.
In android/app/build.gradle:
Inside buildTypes duplicate the "release" block and rename it to "profile". It should look something like this:
buildTypes {
release {
signingConfig signingConfigs.release
}
profile {
signingConfig signingConfigs.release
}
}
Then, build the apk in the profile mode:
flutter build apk --profile
Note that the desired apk is now called app-profile.apk.
Explanation
Flutter somehow changed the way build modes work. From what I understand, the android_alarm_manager libraries/plugin is not included in the release apk. You probably have to fix that using proguard, but I'm not sure how. Please note that building the apk in profile mode is not correct, but works as a temporary fix. I hope that someone more experienced can help us find the correct solution.
Hope this helps!
Regards, Honza
Do you have Internet permission to fetch data from the api? Check the AndroidManifest. Internet permission is set in debug mode, but removed in release. You have to set it manually.
<manifest xmlns:android...>
...
<uses-permission android:name="android.permission.INTERNET" />
<application ...
</manifest>

how to generate .aab from project flutter

i want to generate an .aab file from flutter project using this command
flutter build appbundle
💪 Building with sound null safety 💪
Removed unused resources: Binary resource data reduced from 1224KB to 1154KB: Removed 5%
Running Gradle task 'bundleRelease'... 47.8s
✓ Built build/app/outputs/bundle/release/app-release.aab (21.7MB).
to put it in play.google.com but i get this problem
You uploaded an APK or Android App Bundle that was signed in debug
mode. You need to sign your APK or Android App Bundle in release mode
so in the file android/app/build.gradle i did some modification
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
}
but i get the same problem the .aab is in debug mode and not in release mode how to do it to upload the application in play store ?
You need to sign the app and use the release version, not the debug.
Their web page explains how: https://docs.flutter.dev/deployment/android#signing-the-app

Derffered component not splitting apk when signed with release configuration

I have apk of Flutter having size around 700MB (app has local videos, assets). I have uploaded testflight easily as Apple allows 4GB IPA file. Now to handle this issue on Google play console flutter recommend Deferred components
I followed the official documentation but on last step when I run flutter build appbundle
command with signing configuration
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
differed components are separated from base apk , thats good.
but with
buildTypes {
release {
signingConfig signingConfigs.release
}
}
resulting in a deferred library being compiled as part of the base loading unit.
Any help would be appreciated.

Flutter, play store - There is no deobfuscation file associated with this App Bundle

I am developing Flutter app. I have build my app as the following:
flutter build appbundle --obfuscate --split-debug-info=./debug -v
I'm facing the above warning on play store console:
There is no deobfuscation file associated with this App Bundle. If you
use obfuscated code (R8/proguard), uploading a deobfuscation file will
make crashes and ANRs easier to analyse and debug.
From android studio decode an obfuscated stack trace documentation it seems that I need to upload a mapping.txt file.
I cannot locate the file in my Flutter project. Where is it?
How to upload the file to play store console?
try enabling minify
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
mapping.txt file location
./app/build/outputs/mapping/release/mapping.txt

MissingPluginException in flutter in release mode android

Many plugins aren't working in flutter when you try to build a apk in release mode , but these plugins are working perfectly in debug mode
Some recomend changing the gradle version to 3.5 , but sometimes the plugins used may not be compatible with the same like file_picker_cross
Others recomend using --no-shrink option while building the apk i.e flutter build apk --release --no-shrink
None of that solutions worked for me , i found this solution burried in a github issue conversation
Check the solution below
Looks like the recent proguard rules in flutter is ejecting the plugins which arent registering properly
In your project's app/build.gradle
change
buildTypes {
release {
signingConfig signingConfigs.release
}
}
to
buildTypes {
release {
shrinkResources false
minifyEnabled false
signingConfig signingConfigs.release
}
}
The added extra 2 lines seems to skip the proguard rules part thereby saving your from the nightmare , this is just a temporary work around , there might be a fix soon from flutter
Ofcourse this skips the proguard optimization , but atleast the code works now ;)
I have been wasting my time for almost 6 hours without knowing the solution ,so I am posting it here for others