How to help Flutter find bundled Java version of Mac OS Ventura? - android

I've been trying to install Flutter and I am blocked by my Android Studio not being able to find my bundled Java.
Flutter doctor tells me on my terminal it's unable to find bundled Java version.
I've tried installing a new Java version, uninstall, change path of my zsh profile, nothing works.

Related

flutter doctor --android-licenses not working on macOS Catalina

Recently I upgraded my Mac to Catalina.
I installed Java, set JAVA_HOME to $(/usr/libexec/java_home) as per the documentation. I installed Android Studio and SDK tools and set the ANDROID_HOME variable to /Users/username/Library/Android/sdk.
I downloaded flutter, and added flutter/bin to my env variable $PATH, and when I run flutter doctor, it's running fine and giving me the results as expected, without all the features checked however as I am setting it up for the first time.
But when I run flutter doctor --android-licenses, it's giving me an error which says:
Android sdkmanager tool was not found, try re-installing or upgrading your Android SDK.
Run the command flutter upgrade.
Then run the command flutter doctor --android-licenses.
Actually it was the then latest version of Flutter 1.12.13+hotfix.8 installed, which was not reading the cmdline-tools folder from the latest Android SDK home.
Also to be on the safer side, just create a folder tools inside <path-to-sdk-home>, and copy the contents of <path-to-sdk-home>/cmdline-tools/latest/ to the folder <path-to-sdk-home>/tools/.

Nativescript Android Emulator Not Running

It's been 4 days since I tried to setup my Android environment but still I get a bunch of errors. I gave up to the point I re-installed my Mac OS, but still found no solution
I installed nativescript as the docs recommended, but when I run tns doctor I get the following error:
✔ Getting environment information
TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.
There seem to be issues with your configuration.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 4.1.2 version and is up to date.
✔ Component tns-core-modules has 4.1.0 version and is up to date.
✖ Component tns-android is not installed.
✖ Component tns-ios is not installed.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods update is not required.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✖ The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the `ANDROID_HOME` variable to point to the root of your Android SDK installation directory.
✖ WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
✖ WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to run your apps in the native emulator. To be able to run apps
in the native Android emulator, verify that you have installed the latest Android SDK
and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run `$ sdkmanager` to manage your Android SDK versions.
✖ You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=27'.
Run `$ sdkmanager` from your command-line to install required `Android Build Tools`. In case you already have them installed, make sure `ANDROID_HOME` environment variable is set correctly.
✖ You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run `$ sdkmanager` to manage the Android Support Repository. In case you already have it installed, make sure `ANDROID_HOME` environment variable is set correctly.
✖ WARNING: CocoaPods is not installed or is not configured properly.
You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.
To be able to build such projects, verify that you have installed CocoaPods.
You have nativescript-cloud extension installed, so you can execute cloud builds, but your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options:
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.
You have nativescript-cloud extension installed, so you can execute cloud builds, but your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options:
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.
? To continue, choose one of the following options: (Use arrow keys)
❯ Try Cloud Operation
Configure for Local Builds
Skip Step and Configure Manually
I checked every error and every URL in every error without figuring this out.
I checked that $ANDROID_HOME is in my ~/.bash_profile as well as $JAVA_HOME.
My ~/.bash_profile have these two paths:
export ANDROID_HOME=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/Home
When I run tns doctor and select the 'Configure for Local Builds' it starts re-downloading 'Google Chrome', 'Homebrew', 'Java SE' etc. and even then I still get the same error.
I tried to specify the emulator even then I get the same output as the 'tns doctor' command.
If you don't want to install Android Studio, you can try to follow this step-by-step setup.
On macOS, from my experience the best solution is to install Android Studio.
After that, you can use Android Studio to manage the SDK versions and android emulators (which is better to debug, profile and see logs during development) and accept licenses.
The environment variables (to be added to your bash profile) to point to Android Studio installed SDK and build tools are:
export ANDROID_HOME=/Users/{{ username }}/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
Then, restart your computer (otherwise, you probably won't be able to launch emulators from Android Studio). After the restart, open a terminal and type
echo $ANDROID_HOME
to verify that the path is correctly set.

Flutter installation error with license in Linux

I got 3 errors while installing flutter :
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Android Studio
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
I can install plugin(s) in android studio but how to resolve android licenses problem , I ran "flutter doctor --android-licenses" it shows all the licenses how to know which license is not accepted and how to resolve it
Thanks in advance
Its very simple to install flutter, just you have to follow some steps.
The first and foremost thing, you need to have a OS (LINUX, MAC, WINDOWS) and a editor.
If you are using Linux as OS and Android studio/ intellij platform, you can proceed with below mention steps.
1.1. setup an editor, i would prefer android studio.
1.2. Start Android Studio.
1.3. Open plugin preferences (Preferences > Plugins on macOS, File > Settings > Plugins on Windows & Linux).
1.4. Select Browse repositories, select the Flutter plugin and click Install.
1.5. Click Yes when prompted to install the Dart plugin.
1.6. Click Restart when prompted.
Next, install flutter SDK,
2.1. goto ths link : https://flutter.io/docs/get-started/install/linux
here you will find the flutter stable version as a .tar.gz, download this to your download folder(ex.)
2.2. open terminal paste this: tar xf ~/Downloads/flutter_linux_v1.0.0-stable.tar.xz
2.3.press enter. It will extract and make a folder name "flutter"
note*: that folder is installation folder, if you delete this, your flutter installation is gone, you need to reinstall (step 2.1, 2.3)
2.4 Add the flutter tool to your path: (paste in terminal)
export PATH="$PATH:pwd/flutter/bin"
This command sets your PATH variable for the current terminal window only. To permanently add Flutter to your path
2.5 write in terminal: flutter doctor
it will show some infos, scroll down, it will show the require things needed.
for my case, i had to install this: sudo apt-get install lib32stdc++6
and accepted the licenses : flutter doctor --android-licences
Next, open android studio, make new project
3.1 Select File > New Flutter Project.
3.2 Select Flutter application as the project type, and press Next.
3.3 Make sure that the Flutter SDK Path text field specifies the location of the SDK.
3.4 Enter a project name (for example, myapp), and press Next.
3.5 Click Finish.
Then you are done :)
For other platforms, the basic installation idea is same as this, you can go through the flutter official doc.
Did you complete the additional task to be completed as reported with flutter doctor command?
Could we see the full output from flutter doctor and flutter doctor --android-licenses respectively?
See Run flutter doctor section under Get Started: Install.
after making sure you've updated your sdk
and installed flutter and dart plugin
restart your Android studio then run in order
flutter doctor
then
flutter doctor --android-licenses
then press yes
If flutter doctor --android-licenses don't work then I would recommend to export to java 8 instead of java 10. It worked for me

Error when building android APK

I have Android-studio 2.3.2 (which is android-studio-ide-162.3934792-linux.zip) installed, which is the latest stable version. I am using fedora 24. I am using meteor 1.4.4.2
When I build an APK using "meteor build" I get this error:
While building Cordova app for
platform Android: Could not find gradle wrapper within Android SDK.
Might need to update your Android SDK. Looked here: ~/Android/Sdk/tools/templates/gradle/wrapper
It seems to me the path to gradle wrapper has changed on the latest version of Android-studio. I don't have a previous version of Android-studio to prove this though. I've searched for previous versions of Android-studio and could not find them. I have searched for a solution but there is no one out there who seems to be solving this issue.
You will find a solution in this other thread and some explanation in this answer
The explanation is that the linux version of cordova does not search for gradle in the Android studio install folders like for Windows (and even for windows it does not find it if android studion is not installed in c:\program files\android\android studio) or Mac .
On Linux (and maybe for Mac&Windows in future versions of Cordova), you have to install a version of gradle and add it to your path (way to install gradle depends on the version of Linux you're using)
The behaviour was different in the past because android sdk was not inside Android studio like it is now. You could find gradle in the ANDROID_HOME/tools folder.
With recent upgrades, Android SDK structure has changed and it is now part of android studio.
Installing android-sdk_r24.4.1-linux.tgz which installs version 25 or higher version by default solved the problem for me. Because I could not find a way to uninstall Android Studio I had to uninstall and re-install my linux.
See https://gist.github.com/rolandboon/0a5abe1d9c6c515c59ec for downloading and installing the sdk

Visual Studio Cordova project won't build when running on Parallels

I installed Visual Studio on Windows running in Parallels on my Mac.
When creating a new Cordova project and to debug with VS Android Emulator, it fails with:
java.lang.IllegalArgumentException: URI has an authority component
I read somewhere that this happens when sharing is enabled with Parallels. If I disable sharing I get a new error:
java.io.FileNotFoundException: \\Mac\Home\.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oiejfej094b\gradle-2.2.1-all.zip.lck (The network path was not found)
Which I understand, because \Mac\Home will obviously no longer be available.
What I can't figure out is who or what is looking in \Mac\Home for Gradle, or anything else for that matter. Is it my VS installation? Something in my application? Android SDK? Java? Some NPM package?
Edit:
I'd done a full repair install of Visual Studio, I've reinstalled Node from scratch, Android SDK, and JDK - who knows about \Mac\Home?????
It was Java. \\Mac\Home existed when the JDK was installed, and installing a newer version of the JDK didn't make VS use it - I manually set it in Tools -> Options -> Tools for Apache Cordove -> Environment Variable Overrides

Categories

Resources