How does Flutter detect that VSCode is installed? - android

I have a portable version of vscode on my Windows PC. I have flutter installed as well. flutter doctor does not detect my VS Code. I'm guessing it is because its not installed via an installer. It was just copy pasted into a folder.
How can I tell flutter where my VSCode is and that it is my preferred editor without installing it (since I do not have admin rights on the PC)? I tried flutter config -h and it only lists the following options
--[no-]analytics Enable or disable reporting anonymously tool usage statistics and crash reports.
--clear-ios-signing-cert Clear the saved development certificate choice used to sign apps for iOS device deployment.
--gradle-dir The gradle install directory.
--android-sdk The Android SDK directory.
--android-studio-dir The Android Studio install directory.

We only look in the default install locations for each platform. You can find the code here:
https://github.com/flutter/flutter/blob/217b2bdaa18de2bfddf213bc920b1337e77f1be3/packages/flutter_tools/lib/src/vscode/vscode.dart#L87-L154
You're not missing out on anything by not having it found, all Doctor does is lists it if it's found and tells you if you're missing the Dart Code extension.

Related

Problem setting up flutter using command-line tools

I'd like to use vscode as my main editor for flutter development. I successfully setup the commandline tools (v6200805) and created a virtual device using avdmanager. I was also able to launch the device using the flutter emulators -launch command. However on using flutter doctor command, flutter does not recognize the sdk path. The latest version of the commandline tools follows a different file structure as compared to the previous version.
Also, I configured flutter to know the dir of Android sdk path using
flutter config — -android-sdk E:\IDEs\Android\cmdline-tools\ but to no luck.
How do i work around this problem?
Error shown by flutter doctor

can I use flutter without downloading android studio?

I was just wondering if I can use flutter without downloading Android studio because Android Studio is very heavy
You can do so, by following the below steps.
Note: The sum of all the downloaded files is about 1.5GB including VS Code.
Download and install VS Code 88MB.
Install the Flutter extension, which automatically installs the Dart extension.
Download the Flutter SDK 818MB. Extract to C:\Flutter.
Download the Android Command Line Tools 115MB. Extract to C:\Android\cmdline-tools.
Download the Android Platform Tools 5MB. Extract to C:\Android\platform-tools.
Download the Java SDK (version 17 or lower) 171MB. Extract to C:\Java.
In Environment Variables edit the Path system variable and add the following:
%SYSTEMDRIVE%\Android\platform-tools +
%SYSTEMDRIVE%\Android\cmdline-tools\bin +
%SYSTEMDRIVE%\Flutter\bin +
%SYSTEMDRIVE%\Java\bin.
In Environment Variables add the following new system variables.
Name: JAVA_HOME. Value: C:\Java.
Name: ANDROID_HOME. Value: C:\Android\cmdline-tools.
Name: ANDROID_SDK_ROOT. Value: C:\Android\cmdline-tools.
Run the following command as administrator: sdkmanager --licenses, and accept all the licenses.
In phone's settings, enable Developer options and USB debugging, also enable the Developer mode on your PC.
Connect your phone and make sure that all drivers are installed.
Create a new flutter project and run it using the command flutter run. This will download the needed files (automatically) to run the app on your phone and create an APK file. Download size is about 300MB.
You can use Visual Studio Code or Emacs Link
You can still code, but it won't compile, since Flutter SDK needs the Gradle and other tools(that comes with android studio) to be compiled and run in Android, and the flutter doctor in the command line will complain too and won't let you do much.
Yes you can, you want to download VSCode and get the dart & flutter extensions in it, but you need AVD which is provided with Android Studio to run your applications or you can use any other emulator.
Needless to say you also need the Flutter SDK.
You could try https://dartpad.dev/flutter if you're not planning anything big. It's a flutter version of the dart playground and it lets you test some flutter features, but (as far as I know) it's limited to one file only. And you won't be able to use 3rd party libraries too.

How to build .apk & .ipa in Flutter, using Android Studio?

I am new to Flutter developement.
I kept reading, understanding & following Flutter Documentation and has created my first flutter app in Android Studio IDE. It is working fine in android emulators.
Now I want to test application in iOS simulator but I don't know how to generate build for iOS.
Is it possible to generate .ipa through Android Studio IDE? If yes then how can I do that? Also I can not build .apk, what are the steps for that?
Thanks in Advance...
You can use
flutter build apk --release
flutter install
To build for iOS you need a Mac, because it depends on XCode to compile parts of the application.
You should first install X-Code and Android Studio (with Flutter settings and SDK enabled) on macOs, then copy your source code there and open with Android Studio.
After that run flutter clean, flutter packages get and flutter build ios commands in order.
If you have used some libraries that are not supported in iOS they must be omitted or replaced in the project (it can be determined by seeing the library's official page on pub.dev).
Then connect the iPhone to mac and if everything is OK it should be visible in device list section, finally press the Run button to finalize required dependencies by downloading from the internet.

TFS on-premise Xamarin cannot find AndroidSDK

I have a build definition set up in our on-prem TFS 2018 instance and it's just not working for us.
We have Visual Studio 2017 Enterprise installed on the TFS server instance, including Xamarin Studio, pointing to the default /program files (86)/android/android-sdk location, and we've created two (2) environment variables on the Server, called AndroidSDK and Xamarin.Android, yet we're still getting a build failure:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets (617, 2)
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(617,2): Error XA5205: The Android SDK Directory could not be found. Please set via /p:AndroidSdkDirectory.
Process 'msbuild.exe' exited with code '1'.
We've tried setting /p:{} as an Additional parameter in the Android build step, but this also fails unexpectedly.
Are we missing something here? Any help would really be appreciated.
Note we're trying out on-premise for our team
This issue is most likely due to one or both of the following reasons:
Android SDK Tools are removed accidentally (or Antivirus has removed
these tools)
Android SDK Platform-tools are removed accidentally (or Antivirus
has removed these tools)
In case of this issue, SDK manager will not work. And the options to
run SDK Manager within Visual Studio will also be disabled. On the
Android SDK installation path one or both of the following folders
will be missing:
tools
platform-tools
So, you just need to reinstall the Tools. Please refer to Wasim's blog for details.
Besides, in TFS the build agent on the server runs in its own account (build service account), so the Android SDK must be accessible to it. which meant that a local build on the server may worked fine, but the TFS build agent couldn't access it and thus failed. In this case, you can move the SDK to an accessible place for the build agent service account, thus everything will be worked.
Refer to this link for details :
Resolving “The Android SDK Directory could not be found” building a Xamarin app via TFS build server

To add android in phonegap platform using cordova [duplicate]

Helo,
I am currently trying to build the base phonegapp android app that's automatically created, so I navigated to the directory... but when I use the command
phonegap build android
I just get this random error, as shown in the attatched picture.
Extra info
I am currently on Windows 8, and am completely new to making apps, and am new to the command line as well. Not very familiar with this stuff...
What I'm trying to do would be called 'compiling', right?
Yeah, I had the same problem yesterday - but with a little help of a colleague I got it!
Step by step tutorial (for Windows)
Install node js
Install phonegap using command line: npm install -g phonegap
Install Android SDK
Launch Android SDK Manager and install Android 4.4.2 (API19)
Because latest phonegap/cordova version requires this
Documentation for Android SDK and SDK Platform should be enough
Also update already existing packages
Create an environment variable called ANDROID_HOME which points to destination of Android SDK. e.g. C:\Users\You\AppData\Local\Android\android-sdk
Download Apache Ant and extract the archive somewhere
Create an environment variable called ANT_HOME which points to destination where you have extracted Ant
Install JDK (Java Development Kit) for your System. Before you are able to download, you have to accept the licence
Create an environment variable called JAVA_HOME which points to destination of JDK
If you want to add plugins via phonegap automatically you should also install GIT.
Last but not least you need to add the following directories to PATH environment variable:
%ANT_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin
Each folder is separated by a semicolon
Setting environment variables will take effect just for new command line windows. So you should reopen it, after the whole process.
Easy, isn't it? ;-)
Now you can use phonegap build android after you've created a new phonegap project. If you have your smartphone plugged via USB and installed the USB drivers, and activated the USB Debugging on smartphone, you may use
phonegap run android
And the ready build APK will be transfered and executed on your smartphone. Perfect for testing.
If you want to create a final release APK, go to
YOURPROJECT\platforms\android\ant-build
and enter ant release.
You'll find the final APKs in YOURPROJECT\platforms\android\bin.
They are unsigned, here is a Noob guide to signing an APK.
I have tested a Barcode Scanner example, and it works seamlessly.
Have fun!
also check android in cmd, if it says: 'xcopy' was not recognized.
then add to your path:
%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;
Armin's guide is perfect. But if you still fail you can do this.
Phonegap platform files stay in C:\Users[username].cordova\lib folder. Go there and remove android/ios/bb... driectory.
For best result run this command:
npm cache clear
After that try again, clean platfrom files will be download and build your project.

Categories

Resources