I cannot stop the debugger - android-studio

I'm trying to stop debbuger from running and I cannot figure out how. I've read everything here and still nothing. I made a weather app in flutter and I am ready to upload it to google play but I get the error that tells me I need to stop debbuging. Anyone know how to? Notice the debug banner on top right

You need to build a release version, using flutter build apk --release.

On your MaterialApp set debugShowCheckedModeBanner to false.
MaterialApp(
debugShowCheckedModeBanner: false,
)
The debug banner will also automatically be removed on release build.
If you are using emulator or real device and you want to check it on release mode
then =>
flutter run release --apk
run this command on terminal Android Studio / Vs Code

Related

Flutter "Entrypoint isn't within the current project." error on Android Studio

Flutter app runs on VS Code with Start Debugging & Run Without Debugging and also with terminal command "flutter run" .
However it runs on Android Stuido only with terminal command "flutter run".
When I try to run it on Android Studio, with the play button which triggers the build, I get this error :
"Entrypoint isn't within the current project."
Invalidate Caches and Restart, flutter clean, quitting and restarting Android Studio are some options I tired with no success at all.
Have any of you faced the same issue?
What can be the problem? And please the solution...
Thanks in advance,
Oz
Here's the image of Run Config :
Click on File-> Project Structure -> Module then add root folder of your project then it will detect its a flutter app and then build
It works for me, hope it will work for everyone.
Goto File -> Project Structure -> Module
Or
in edit configuration, just name it "main" and locate the location of 'main.dart' file in the Dart entrypoint text field.
Please take a look at the below screenshot.
Run/Debug Configuration screenshot

I try to make android studio (emulator) work with vs-code but have an error "avdmanager is missing from the Android SDK"

This is my PATH
export ANDROID_SDK_ROOT=/mnt/sda1/DevTools/sdk/
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=${PATH}:/mnt/sda1/DevTools/sdk/platform-tools
I try many cases, but still this error!
Try :
flutter doctor --android-licenses
if something wrong, try to locate android sdk path.
flutter config --android-sdk {path}
Mine :
flutter config --android-sdk C:\Android\Sdk
This worked for me. If you have sdkmanager, avdmanager and emulator, and you have them in your PATH environmental variable, then
Download a system image:
sdkmanager "system-images;android-30;google_apis_playstore;x86_64"
(you can find available packages with sdkmanager --list --verbose)
Create a new virtual device with
avdmanager create avd --name MyAndroidDevice --package "system-images;android-30;google_apis_playstore;x86_64"
Start the emulator
emulator -avd MyAndroidDevice
Now restart VSCode and open your Flutter project. The new device should be at the bottom right corner or you should be able to choose it by clicking on "No device".
For me, I had to restart my VS Code for the installation of Android SDK be reflected upon it.
I know this is an old question but setting my $PATH variable in ~/.bashrc (I'm on Ubuntu 20.04) did not work for me.
I needed to setup Android Emulator for VScode, because I wanted to run my flutter app, which seems to be the same issue as OP had.
Instead of setting the $PATH directly you can actually use Flutter in the terminal to do it.
If you run "flutter config" in the terminal you get something like:
Configure Flutter settings.
To remove a setting, configure it to an empty string.
The Flutter tool anonymously reports feature usage statistics and basic crash reports to help
improve Flutter tools over time. See Google's privacy policy:
https://www.google.com/intl/en/policies/privacy/
....
Run "flutter help" to see global options.
Settings:
android-sdk: <my_path_to_android_tools>
Analytics reporting is currently enabled.
You can then see the $PATH that is currently set with flutter under:
Settings:
android-sdk: <my_path_to_android_tools>
Mine was incorrect so I changed it to the current one with the command:
flutter config --android-sdk <my_path_to_android_tools>
Afterwards I restarted VScode and when it was finished loading I could now press the "device" button in the right hand corner and then select emulator that I had already created. I used one of the above answers to install the emulator itself.
It took a while to launch the emulator the first time due to installing some dependencies but it did work!
I tried this and works:
from terminal run flutter config --enable-android. You will get Setting "enable-android" value to "true".
after that open android studio, set up virtual devices first if you haven't. Open Android Studio -> Configure -> AVD Manager -> Create Your Virtual Device
Go back to your VS Code, open command Palette (Ctrl+P or cmd+P, then type >), or from View -> Command palette... -> Flutter: Select Device -> choose your android device
I faced the same issue and solved it running flutter doctor from the terminal, in VS Code. In my case, I had the android sdk located in a custom location (D drive), the reason why it wasn't found automatically. The "doctor" told me to run flutter config --android-sdk <my-sdk-custom-location>. Running it and restarting the IDE made the trick. Hopefully this helps someone facing the same problem.

App running on debug mode only for Flutter

I am not sure what is wrong with my Android Studio IDE, but whenever I run the app inside flutter it always runs on debug mode. Please see the label on the right side of the corner.
Logs:
Launching lib\main.dart on POCO F1 in debug mode...
Initializing gradle... Resolving dependencies... Running Gradle task
'assembleDebug'... Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk... Syncing files to device
POCO F1...
Have you tried running your code in "release" mode?
Within a terminal you can do that via flutter run --release.
In Android Studio you could double tap shift to bring up the search everywhere command window. If you simply type release you should be able to find the Flutter Run main.dart in Release Mode command.
Also you can find this in the menu under "Run" just like so:
Running commands:
App by default runs on debug mode, it is bit janky but needed to provide features like hot reload and hot restart. However, if you want to run the app in other modes, try these commands:
Release mode:
flutter run --release
Profile mode:
flutter run --profile
Adding flags in the IDE:
You can also add these flags in IDE, click on main.dart in the toolbar:
Add --release flag in the Additional run flags option
From Run→Edit Configurations, you can create two configurations (copy and paste the first, then rename) add additional’s arguments as --debug for debug an --release for release and chose one of those to start your app in Debug mode or Release mode (Let gradle to build for you :) ).
If you build your apps in vsCode.
Then, open your terminal(CTRL + `) and type a command.
flutter run --release
To remove the flutter debug banner, there are several possibilities :
1- The first one is to use the debugShowCheckModeBanner property in your MaterialApp widget .
Code :
MaterialApp(
debugShowCheckedModeBanner: false,
)
And then do a hot reload.
2-The second possibility is to hide debug mode banner in Flutter Inspector if you use Android Studio or IntelliJ IDEA .
3- The third possibility is to use Dart DevTools .
But if you want to switch to release mode ,
Use this command for running your app flutter run --release
or
In Android Studio , click on :
> Run
> Flutter Run 'main.dart' in Release Mode
I always prefer to learn shortcuts
You can use the following Shortcuts to open the configuration of the run and write --release
ALTSHIFTF10 then Press 0 and Press ALTa
Finally, you are there where you just have to write --release and Press ENTER
Thats it!
I only change package name at /android/app/src/main/kotlin/MainActivity.kt as the same with applicationID at /android/app/build.gradle,
and now it's running...
If you want to just get rid of the debug tag from the rightmost corner of the app,
u can use the
this => debugShowCheckedModeBanner: false
into your main.dart file in the material app widget.

Android Studio does not install app after using the Internal Test Track version

I've been working on my app for a while now and recently uploaded it to the Google Play Console's Internal Test Track. I installed my app via Google Play Store and it worked fine.
But if I now try to install an updated debug version via Android Studio directly it just launches my main activity without installing the changed app.
What I've tried:
Uninstalling app and running in via AS: "Error: Activity class {...} does not exist."
Restarting phone
Restarting AS
Reconnecting phone
Uninstalling app via AS (gradlew uA)
Uninstalling app via app manager
Invalidating AS cache
Cleaning / rebuilding project
Disabling Skip installation if APK has not changed in Run Configurations -> Miscellaneous
Increasing version number
What may cause it:
The Internal Test Track version is signed, but the key is kept by Google
The app is not selected as 'App to debug', but the dialog to choose one, does not offer it
How can I install my unreleased version via Android Studio directly again?
Thanks in advance. -Minding
QUICKFIX
The "Gradle Aware" task was missing for some reason. To fix it "Run" > "Edit configurations" > "+" > "Gradle-aware Make" > "OK" (leave the field empty) and restart.
The Android Studio team is still investigating why this happened.
Old answer / Workaround
Using the ADB to directly uninstall the release version and installing the debug version worked, but you have reinstall the app for every change! A better solution would still appreciated.
Build your project's debug APK
Enter the following into the terminal:
adb uninstall MY_PACKAGE_NAME
adb install -r ./mobile/build/outputs/apk/debug/mobile-debug.apk
If you get "adb" not found. use %LOCALAPPDATA%\Android\sdk\platform-tools\adb instead.
Select the app to be App to debug in the device's developer options.
Hope this help. -Minding

Flutter How to make release version in Android Studio?

By default Android Studio use debug mode when building Flutter application. You can build the release version with the command line, see How to optimize the Flutter App size?
flutter build apk --release
Now: how to configure Android Studio to do the same, when I run the application (Shift+F10)? I can't find this setting...
You have to edit the run configuration:
Open the run configuration:
Add the --release flag:
Note that using the --release flag is not supported when you build with the Android Emulator.
In Android Studio , click on :
> Run
> Flutter Run 'main.dart' in Release Mode
flutter build appbundle --release --build-name=1.1.1 --build-number=3
Or you can run that in your Terminal, Remember to change build name and build number to corresponding values of your release app versioning.
as the green play button in toolbar runs the debug mode, i switched it to release mode via:
Right click Play Icon in toolbar -> Customize Toolbar
click "+", chose Add Action
chose "Plugins/Flutter/Run in Flutter release mode"
Delete the old Play button by selecting it and click "-"
The best way to make your apk for release mode is that open the project -> click on the android folder then make your apk as same as generated application build in android using your .jks key and alias password and name. this is the correct way for making apk in flutter.

Resources