Gradle window in missing in android studio for my flutter project - android-studio

The gradle window is missing in the android studio for my flutter project but it is available for my Kotlin project.
I have to generate the signing certificate SHA-1 to register my app in Firebase.

Here is how you find the gradle section in Android Studio for a Flutter-Project:
Open the build.gradle file in app/src/
There should appear a small bar at the top of the code-editor and click Open for Editing in Android Studio
A new window will open, showing the option for opening the gradle section in the side-panel, as expected.
This answer is giving you a quite extensive explanation for then generating the SHA1-fingerprint.

The problem for Android Studio is that the android(gradle)-project is not top-level.
You can right-click on project- or android-folder, select Flutter->'Open Android module in Android Studio' .
After that the gradle-tab appears on the right and you can use it as intended.

Related

How to show "External Libraries" node in Android studio like it is shown in IntelliJ IDEA?

I need to show "external libraries" widget Android studio like it is shown in Intellij.
In Intellij we have:
but in Android studio for some reason external libraries widget is missing.
and "select the opened file" button does not work.
How to make it work?
Android Studio is using the Android view by default for the Project View tool window, you can switch it to the Project view to see the same list of dependencies as in IntelliJ IDEA:

How to update Gradle plugin in Android Studio

Inside Android Studio I'm getting the error:
Generating signed Bundle requires you
to update the Android Gradle plugin
to version 3.2.0 or higher
If I click "Close this dialog and update the plugin" it goes to another prompt asking whether to update. Clicking "Update" appears to do nothing except close the prompt.
All other similar issues and advice are from a few years ago and the latest version of AndroidStudio has a different interface and have not helped in this situation.
I am running:
Android Studio 3.6.3
Gradle 6.4
UPDATE:
Below is a requested screenshot of the AndroidStudio UI for setting up project structure:
In Android Studio do the following:
1. File -> project structure
2. Select "project" from the left hand side.
3. On the right hand side under "Android Gradle Plugin Version" use the drop-down menu to select the Gradle plugin version you desire.
4. Press "Apply" and then "Ok"
If for some reason you could not do that, you can try:
1. Under "Gradle Scripts" choose "build.gradle(project: ... )".
2. From the right hand side under "dependencies" change the build gradle version to the required or latest one on this line:
3. Do not forget to sync on the top right hand side
In my case I was having the same issue when I after installing it opened Android Studio and tried to Profile or Debug APK. For me the issue was solved when I created a new (empty) project. Then the Android Gradle Plugin updated itself.

How to open an existing Flutter Project in Android Studio

I might sound noob here but I can't see a clear way of opening existing Flutter Project in Android Studio 3.1.2.
I checked this but it didn't work. So I want to know if there is a standard IDE way of doing this? I also can't find any docs clearly mentioning it. Do I need to install a 3rd party plugin?
After opening it as an Existing Android Studio Project, I get the following error:
The error is solved by running Get Dependencies. Is it a normal behavior?
Install Flutter plugin for Android studio: https://flutter.io/get-started/editor/
Open Android Studio
Open existing Android Studio project by using one of below methods:
EASIEST WAY: Drag your project folder and drop to Android Studio.
Other ways:
What works for me was to open existing Android Studio project like mentioned above, and then go to menu
Tools -> Flutter -> Flutter Clean
Then configuration window will open and ask you to locate flutter sdk. After locating the sdk, click OK and then the flutter functions will be available (Pub buttons, runs menu). After that you can proceed to get the dependencies (pub get).
It's basically cleaning the project folder of previous setting(s) which might conflicting with the system (android studio). But that won't happen if you get the project from source repository because all of the junk files wont be in the project folder.
The quickest way on macOS is
open -a Android\ Studio android when you are in the root project directory.
Alternatively, if you use the jetbrains toolbox, you can enable "Shell Scripts" in its settings. This will create a binary in the folder of your choice, so you have to add this folder to your PATH. Then, you can use studio . inside the Android folder, or studio android in the flutter project. The benefit of this, is it also works with other Jetbrains products (e.g. charm project_dir or clion project_dir. Unfortunately this method glitches out (for pycharm at least).
Looks like Android Studio can't load Android Application module from Flutter project automatically. I also have same problem, so in my situation Gradle can't be found, because of lack of Android project.
There's important note from official site:
Important: Do not use the New > Project from existing sources option for Flutter projects
I suggest, same is for Open option.
Just Open your project as normal, and then in [Android Studio > Preferences > Languages&Frameworks > Flutter > Flutter SDK path] select the path where you downloaded & unpacked Flutter SDK.
I know it's already late, but you can open an existing Flutter project in Android Studio by following these steps (make sure you have already installed Flutter & Dart plugin and Flutter SDK):
Click Open from File menu in Android Studio,
Go to the path of the project,
Click Open from the dialog,
When the project opens in Android studio, it will show an error of packages and dependencies. So, click on Get Dependencies on the top. Android Studio will automatically add all the required dependencies and packages.
There is a simple way of doing this in android:
Just Open your project as normal, and on the top right corner, click on Flutter Attach option, and voila!
See Attached screen grab!
Usually you can open your Flutter project in Android Studio simply when you right click on the android folder > Flutter > Open Android module in Android Studio but sometimes this option could be disabled, check this answer to enable..

Importing project in android studio

While importing projects in android studio ,this window comes and never disappear. please help. I am new to android studio
Looks like one of your dependencies that Android Studio is trying to download is offline. Check out this related SO post:
Android Studio stuck on "Gradle: resolve dependancies '_debugCompile'" or 'detachedConfiguration1'

Android Studio can no longer add SDKs, only JDKs. Why?

I've upgraded Android Studio from 0.8.* to 1.0.0 RC2 and finally 1.0. Somewhere between the RC2 and 1.0 Android Studio seems to have lost most of its references to the Android SDK.
Some indicators of this are:
All Android SDK tools have disappeared from the toolbar
No longer possible to attach the debugger or run apps from within Android Studio
In 'Project Structure', the SDKs list shows a list of previously added SDKs but when pressing '+' to add an SDK it only allows me to add JDKs.
In 'Project Structure', the previously added SDKs show "Unknown SDK home path" with a path to the location of the Android SDK. Editing the field with the '...' gives me a "Select Home Directory for Unknown SDK" and pointing to an Android SDK location and pressing OK shows a warning dialog saying "The selected directory is not a valid home for Unknown SDK".
The 'android' facet is an unknown facet type
How do I make Android Studio recognize the Android SDK again?
After a few hours of research (uninstalling and re-installing) I worked out how to fix it but still I don't know how it happened.
These are the steps:
Close your current project
Go to Settings
Click on Plugins
Enable Android Support
Follow the wizard
If you are on Windows, you can right-click the toolbar, and select Customize Menus and Toolbars -> Main Toolbars -> Android.MainToolBarActionGroup. You can also select the SDK Manager and AVD Manager from the Main menu.

Resources