Flutter build.gradle trouble - android-studio

I am currently starting Flutter Blue, a Bluetooth plugin for Flutter. I imported the example -> android -> app folder into Android studio.
However, when I am trying to build and run the code, I get the error: "Flutter SDK not found. Define location with flutter.sdk in the local.properties file. "
I googled around for a solution and added the flutter SDK path into the local.properties file but that hasn't remedied the issue yet.
flutter.sdk=/Users/me/Applications/flutter
I suspect that I am just not using Android Studio or importing the files/code correctly. I am able to compile and run Flutter's default demo app (click-counter) without any issues, so I'm fairly certain Flutter & Android Studio was installed and set up correctly.
My intuition was that the build.gradle could be directly run akin to an APK by Android Studio's device emulator. Any suggestions?
Thanks! https://github.com/pauldemarco/flutter_blue/tree/master/example/android

I was not importing the example correctly into Android Studio. The correct way is to drag and drop the project files into AS.

Related

Android Studio doesn't start building Flutter project

I've installed Flutter, Dart their SDKs and Android Studio plugins everything needed for Flutter app development, as mentioned here:
https://flutter.dev/docs/get-started/install/windows
But when I go to generate a .apk by selecting Build->Flutter->BuildAPK, Android Studio simply does nothing. It doesn't even start building.
However, if I run command:
flutter build apk
It starts building project.
Any idea?
Well I found the answer.
File -> Settings -> Language & Frameworks -> Flutter
Flutter SDK Path was not set here. When I set appropriate path, it started building.

Android Studio not showing Chrome as Flutter device

I got a small problem which accured after reinstalling Android Studio:
Android Studio
Android Studio is not showing Chrome as Device for my Flutter Web project, while flutter doctor shows clearly everything is enabled correctly:
Flutter doctor
I can normally run the flutter project on google chrome using the console or VS Code, but Android Studio does not work. I already checked the Flutter and Dart plugin.
I would be glad if someone who maybe had the same issue or knows how to fix this gets back to me!
Best Regards
Clearly it is not the issue with flutter. It is an issue with your Android Studio installation. You can verify the same by navigating to the your project folder in the terminal (or command prompt) and type
flutter run -d Chrome.
NOTE: The above command works only if you are on master, beta or dev branch and you have already enabled your flutter web support by typing
flutter config --enable-web
I noticed that your path to Android Studio as: C:\Program Files\Android\ Android Studio1
It means that during installation the original Android Studio folder is not deleted. A duplicate folder has been created in the same location. Hence the Android sdk location is must be changed as well.
You can solve this by:
Uninstall Android Studio. Delete the folder at the above location. Reinstall Android Studio. Update sdk path in your sdk manager as well as in your environment variable. (recommended).
Update the sdk folder in the sdk manager as well as your environment variables.

Problems with setting up Android Studio with Flutter on Mac

I made my project on Windows computer, now I'm trying to export to ios on friend's Mac. I've been following this tutorial from part 1 all the way to part 5. How to Install and Setup Flutter for App Development on Mac - Part 1. In other words, Xcode is installed, Android Studio with Flutter and dart plugin installed as well. Android Studio recognizes both simulator and plugged iPhone. When I open the project in Android Studio it looks like this:
Note: Both flutter folder and the project folder are located in "exportalex"
Please try to use terminal and hit this: flutter pub get
You need to load all the dependency before run app.
If still you are facing same issue, please run: flutter doctor
Then share screenshot of result.

Flutter VSCode, unable to android module in Android Studio

Hi I am trying to open Flutter android module in android studio by right clicking android folder and then " Open in Android Studio " but its doing nothing.
I have correctly setup android-studio-dir but still unable to open. I am using Ubuntu 19.04.
This is a bug. I've opened https://github.com/Dart-Code/Dart-Code/issues/1897 to look at this. We previously tweaked this code to look for studio.sh instead of studio but now I'm wondering if that's not consistent. I'll change it to look for both.

Open cocos2d-x-3.7 in Android Studio

What is the proper way to open cocos2d-x-3.7 in Android Studio?
I tried:
Open existing project in Android Studio project > Choose proj.android-studio directory (In another attempt, I also tried to choose the base directory MyGame)
Run
Error: couldn't find "libcocos2dcpp.so.
Moreover, it also does Classes directory in the Project.
Android Studio is only partially supported in cocos2d-x 3.7 and 3.8. With the default project you will only be able to run your app without debugging using Android Studio.
Prior to running your app in Android Studio you will have to compile using the Android Studio flag:
cocos compile -p android --android-studio
You will have to run this command after any changes to your app are made, since the default Android Studio currently doesn't compile your project.
Furthermore the default Android Studio project does not include the Classes directory.
Suggestion: Use Eclipse or Xcode to develop your cocos2d-x projects for now. Hopefully future versions of cocos2d-x will have better support for Android Studio out of the box, this is critical considering Google is dropping support for Eclipse.
When you try to run the application on Android Studio, you get the error couldn't find "libcocos2dcpp.so" because it doesn't have the NDK for building your game.
I recommend you to compile proj.android and import that, cocos2d-x 3.7 doesn't support full Android Studio yet. Do this:
cocos compile -p android
Then import your proj.android to Android Studio.
Now you can run your application but you won't able to debug it, bad news (it will just install the APK on your device or virtual device).
Hope it helps.
Error: couldn't find "libcocos2dcpp.so.
For this you need to compile android studio project first so .so files and classes folder will be generated.
Open your command line and enter the following command to compile your android studio project:
cocos compile -p android --android-studio --ap android-24 --app-abi x86
This will create required files in your proj.android-studio directory.
Now import this project into Android Studio and try to run it.

Resources