After Flutter GIT project checkout, unable to run the project - intellij-idea

So I created a Flutter project in IntelliJ Idea Community Edition on machine A and then uploaded the whole project on GitHub. Now I cloned/checked out from GitHub in the same IDE on machine B, performed the following:
flutter packages get
flutter upgrade
Set up the dart path and all other prerequisites
But, I am still unable to run the flutter project from IDE.
I mean I can't even press the "Run" button.
Where did I go wrong?
You can try performing the same steps as I did. it if you want. Here's the Git repository code
Edit I can run the same project via terminal.
[Update] As requested by Günter Zöchbauer in the comment log, here's the logs for flutter doctor -v
BoringFlutterProject$ flutter doctor -v
[✓] Flutter (Channel dev, v0.5.8, on Linux, locale en_IN)
• Flutter version 0.5.8 at /home/daksh/flutter
• Framework revision e4b989bf3d (8 days ago), 2018-08-09 09:45:44 -0700
• Engine revision 3777931801
• Dart version 2.0.0-dev.69.5.flutter-eab492385c
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /home/daksh/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = /home/daksh/Android/Sdk
• Java binary at: /home/daksh/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.1)
• Android Studio at /home/daksh/android-studio
• Flutter plugin version 25.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] IntelliJ IDEA Community Edition (version 2018.1)
• IntelliJ at /home/daksh/Downloads/idea-IC-181.5281.24
• Flutter plugin version 25.0.2
• Dart plugin version 181.4892.1
[✓] VS Code (version 1.26.0)
• VS Code at /usr/share/code
• Flutter extension version 2.17.1
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
I posted this question because I'm sure many of us will face the same problem, just like we used to face some issues in AndroidStudio back then

It is an Android Studio issue. The IDE doesn't apply the flutter SDK location for every new project you clone.
The workaround is to open the cloned project go to File>Settings(Ctrl+Alt+S). In 'Languages & Frameworks'>Flutter set the SDK path to your Flutter SDK location (e.g. C:\src\flutter). Once you apply the changes and run the 'Packages Get' command the cloned project is fully accessible and understood by Android Studio.

I've succeeded to run you project. When I've first open it showed me that it can't find the location for Dart SDK, once I've set the location of the flutter sdk
as explained here:
Dart SDK is not configured
it automatically update the location of the Dart SDK, then I've had to run get dependencies, then it run.

If you have flutter and Dart plugin installed.
Now the problem is Dart support for this project is disabled now you have to enable it.
Step 1: Go to Settings -> Languages & Frameworks -> Dart
Step 2: Check the "Enable dart support for this project"
Step 3: Set the Dart SDK path to your Dart SDK folder like the picture given bellow
Step 4: Click on Apply
That's all!

Too late but pubspec.yaml-> Pub outdated( on top left of Android Studio's screen) -> build on real device solved my problem

In addition to answer by #Marc Steffens above, to run on Chrome and not an emulator or device, I also had to run "flutter create ." from the project root in the terminal. Note the trailing ".".

What helped in my case, was simply removing the .idea folder in the project root.

Related

Gradle version issue in dolphin Andriod studio version

After the updating the new version of Android Studio ,I am facing the error message in our Android Studio.
**> Unsupported Gradle.
> The project uses Gradle version which is incompatible with Android Studio 2021.3.
>
> Possible solution:
> Open Gradle wrapper settings, upgrade version to 3.0 or newer and reload the project
> **
I am try to solve bit it had not solved.
I created new project because I think it is temporary error but after all is has not solved the issue.
I would recommend updating Gradle for your project.
You can execute the follwing commands from the command line (in the root directory of your project), or you can just click on the "terminal" tab at the bottom of Android studio.
First, check your Gradle version:
./gradlew --version
You will get a lot of results, but you only care about the line that says something like this:
------------------------------------------------------------
Gradle 7.4
------------------------------------------------------------
Assuming you are on an earlier version of Gradle, you can update to the latest by using the following command (replacing '7.6' with the version you wish to use):
./gradlew wrapper --gradle-version 7.6
Depending on your project, that should be all you need. If you have incompatabilities with your code and the version of Gradle, Android studio should issue you further guidance.

How to solve Could not find com.android.tools.build:gradle:4.1.1.?

Can't build react native app in android studio.
I tried:
Sync Project with Gradle Files, but I can't do it because of an
error
File -> Invalidate Caches/ Restart
Clear cache from $HOME/.gradle
Delete $HOME/.gradle
Change com.android.tools.build:gradle version on 2.3.0, because it's
the latest version in this list
(https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/tools/build/gradle/), but when I use npx react-native init projectName, used Android Plugin Version 4.1.2, but this version there isn't in this list.
Also know the difference between Gradle, Android Gradle Plugin,
Gradle Wrapper, already read https://developer.android.google.cn/studio/releases/gradle-plugin?hl=en. I tryied to use the latest Gradle v. 6.8.2 and Android Gradle Plugin v. 4.1.2, it also didn't help to build the project.
Change distributionUrl in
projectName/android/gradle/wrapper/gradle-wrapper.properties
Change in File->Settings->Build, Execution, Deployment->Gradle use
Gradle from Specified location and set C:/Gradle/gradle-6.8.2, it didn't help and left it at default
I know there are exactly the same questions on stackoverflow and on github, but the solutions haven't helped.
Build output:
Could not find com.android.tools.build:gradle:4.1.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :react-native-settings
Add google Maven repository and sync project
Open File
Now used:
Gradle v. 6.5
Android Gradle Plugin v. 4.1.2
gradle-wrapper 6.5-all
Android Studios 4.1.2
Android SDK Platform: Android 10, 9, 8.1, 8.0, 7.1.1, 7.0
Your google Maven library is missing. Rebuild project after adding it

Where is Dart SDK? | Error: the folder specified as the Dart SDK home does not exists

I installed Dart Plugin in IntelliJ IDEA and set Dart SDK path in settings page and got this error message Error: Dart SDK is not found in the specified location. What path should I set here? Where is Dark SDK?
I went to this page:
https://dart.dev/get-dart#install
and I installed dart following Install the Dart SDK section.
As the following instructions show, you can use a package manager to easily install and update the Dart SDK.
dart command is here: /usr/local/bin/dart.
but I cannot set this path as Dart SDK path in IntelliJ.
$ which dart
$ /usr/local/bin/dart
You can set the path this way in Preferences > Languages & Framework > Dart : Dart SDK Path
/usr/local/opt/dart/libexec
Or
/usr/local/Cellar/dart/2.8.3/libexec
not
/usr/local/bin/dart
I installed dart using Homebrew. I was able to get this path by running the command brew info dart but the above path should work for you as well
navigate to the folder where you have kept your flutter folder and then just go to bin folder inside your flutter folder, and then to cache and here you go, you found dart sdk .location of dart sdkdart sdk in android studio
C:\src\flutter\bin\cache
sometimes you add dart SDK with flutter SDK on developer folder if you using mac os ..
try this
/Users/username/developer/flutter/bin/cache/dart-sdk
We should give the path for the 'dart-sdk' folder not the bin folder inside 'dart-sdk' folder.
https://stackoverflow.com/a/62186444/10405867
yes, #Prateek Thakur answer is the best answer to be accepted.
To add the information.
if you have installed from brew, mine using macbook m1 - apple silicon
the default path is:
/opt/homebrew/opt/dart/libexec/bin/dart
if you are downloading from https://dart.dev/get-dart archive (link: https://dart.dev/get-dart/archive), you need to set the correct path on your local path where you downloaded the sdk archived folder.
in manjaro if you installed from pamac(add/remove), then the command will be at
which dart
/opt/flutter/bin/dart
So to solve this issue in intelliJ Idea..
Go to new project => dart => then in the Dart SDK path click on the ellipses
then locate this
/opt/flutter/bin/cache/dart-sdk

Run intellij plugin on Android Studio

I'm developing an intellij plugin supposed to be used in android studio.
I've already setup the plugin development environment, but when I hit "Run" command it starts a new intellij instance with the plugin installed.
What I'm looking for is how to run the plugin directly on Android Studio, is that possibile? The only place where I think it can be configured is from "Run configurations" but I do not find anything useful there.
Thanks
You can specify the platform to run on in the IntelliJ Platform Plugin SDK settings, under Platform Settings | SDKs in the Project Structure settings. Point the IntelliJ Platform Plugin SDK home path to your Android Studio installation.
Another option is to create a new Plugin Run Configuration. In the Run Configuration it is possible to specify the JRE to run on. Click on the ... button there and select an Android Studio installation directory (e.g. /Applications/Android Studio.app/Contents on the Mac). This way it is possible to create a Run Configuration for all IntelliJ Platform IDEs you want to test your plugin on.

Intellij plugin development "the selected directory is not a valid home for intellij platform plugin sdk"

I'm following these guidelines on how to develop Intellij plugin.
So I
Open project settings.
Project SDK --> New
Choose the community edition path I just downloaded
Expected the directory is selected fine.
Actual: I get the error message:
"the selected directory is not a valid home for intellij platform plugin sdk"
See screenshot:
Am I doing something wrong?
Thanks
Intellij platform plugin sdk home should be your installed or builded IntelliJ, not sources. You can add that intellij-community folder as sources to your IntelliJ SDK later or not at all.
Goto Intellij installed directory
C:\ProgramFiles\JetBrains\IntelliJ IDEA Community Edition 2016.3.4
Select plugin folder
Create a directory (eg: scala)
Copy the scala lib folder
Restart the intellij
In my case, I had to download a newer IDEA version (Community Edition) and after the installation, everything worked fine.
This is the official and updated link for setting up your plugin development environment.