I followed these steps to run signingReport in order to get the SHA1 fingerprint of my debug.keystore .
However, it's left me with the problem that whenever I click the green arrow Run button in Android Studio, it runs signingReport instead of installing and running the app on my device/emulator.
How can I make it so the green arrow Run button will install and run my app again like it used to?
Solved it by clicking on Run > Run... > Edit Configurations... > expand Android App > select app > click the blue Run button.
Related
How can I skip the permission consent dialog when an app is installed and run by Android Studio?
That is, how can I avoid the screen below when tapping ^R or clicking on "Run"?
Add the -g flag to the "install flags" of the "Run" configuration:
Go to Run > Run… > Edit Configurations…
Add -g to the "Install Flags" field.
(See adb shell pm help for other options.)
I'm building a flutter app on a mac for the first time. Android studio doesn't provide me any way to build or run the app. The green triangle run button is greyed out, and it doesn't have a spot for me to select my emulator.
If I open an emulator and run the app from the command line it builds and runs just fine. The only issue is that android studio doesn't give me the option to run it at all.
Here's what my android studio looks like
And here's flutter doctor
I'd prefer to not switch environments and to continue being able to develop with android studio, instead of switching to xcode or VScode.
Thanks for any and all help!
The green triangle run button is greyed out for me too in Android Studio but the project can be run from command line using "flutter run".
To enable the run button in Android Studio, go to Settings->Languages & Frameworks->Dart:
Enable Dart support for the project (checkbox)
Set the Dart SDK path (on my machine it was "C:\flutter\bin\cache\dart-sdk")
Select the modules to enable Dart support
Screenshot of Android Studio Dart settings
Open pubspec.yaml in your IDE and click on packages get option
This should fix your problem.
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.
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.
Im trying to run Clean and Rerun feature in android studio with cmd + control + r but nothing happens.
Who can I test the shortcut?
I used first the option on the menu, activated the option to use always the same device and then the shortcut worked. not sure why is not working as expected.