Couldn't set my Java version right for flutter on mac - android

I am planning to install flutter on my mac, but have troble to install it. with error
Unable to find bundled Java version. i sourced all possible solutions i could for stack over flow but no luck.
Terminal output
any help is appreciated. thanks.
i tried below: but no luck because i don't have jre in android studio instead i have jbr. i am using Android studio eletric eel
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
flutter doctor -v
reference: my android is working fine.
enter image description here

Related

Install android studio on garuda linux

how can I install android studio on garuda linux using Terminal (fish konsole)
I have already tried to download android for debian but was unable to extract and install
INSTALLING ANDROID STUDIO ON ~: fish - konsole
On Arch Linux, snap can be installed from the Arch User Repository or by running a couple commands as follows.
clonning snapd
git clone https://aur.archlinux.org/snapd.git
cd snapd
makepkg -si
Once installed, run the folowing command to enable snap communication socke.
sudo systemctl enable --now snapd.socket
To enable classic snap support, run the following
sudo ln -s /var/lib/snapd/snap /snap
log out and back in again, or restart your system, to ensure snap’s paths are updated correctly.
Installing Android Studio
To install Android Studio, simply use the following command:
sudo snap install android-studio --classic
Thank you.

How do I uninstall android studio in Ubuntu 20.04

I download Android Studio - Arctic Fox | 2020.3.1 from their official website in my ubuntu 20.04 LTS.
My installation Process:
I downloaded the zip file and extracted it.
I cd into the /bin/ directory and executed the studio.sh file using ./studio.sh command.
The installation went through but now I'm having a lot of problems.
I want to completely uninstall it without altering anything but don't know how.
I would be glad if anyone could help me.
studio.sh is not an installer. It is the starter.
Uninstall is to delete the directory where you extract the package, no other steps.
BTW, I run Android Studio Arctic Fox on my Linux Mint very well, what are your problems? Mint suppose to be same as Ubuntu.
First, try to delete all the hidden files of Android from the home directory if any exist.
Then, type the following commands in Terminal.
$ cd /usr/local
$ sudo rm -r ./android-studio
sudo snap remove android-studio
As you installed with zip file go into directory where you installed it then do rm file created there
note if you have added it to you path also you need to remove it by rm -rf android-studio/bin/

Unable to find bundled Java version with flutter doctor, after updating Android studio Arctic Fox(2020.3.1) on M1 Apple Silicon

I'm facing a weird issue. Before I updated my Android Studio, everything went fine in flutter doctor. Once I've updated Android Studio, when I run the doctor, it's showing "Unable to find bundled Java version". I've already downloaded Java installer and installed it on my M1 Mac, but after I restarted, running flutter doctor still shows the same error. The weird thing is, when I uninstall the Arctic Fox version and re-install the older Android Studio version, everything goes fine again when running the doctor. How can I resolve this?
The answer is already posted here.
For Mac User:
Set Java_Home path using below article & then after applying this command.
after that type below command in terminal:
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
flutter doctor -v
If you are using Android Studio Electric Eel | 2022.1.1.
On Mac
Open "Applications" in Finder. Then right click on Android Studio, select "Show Package Contents".
Inside it, open the "Contents" folder. Inside it you will see folder with named "jbr".
Simply duplicate the "jbr" folder. Then, rename the copy folder to "jre".
Then, flutter doctor. The "Unable to find bundled Java version" warning will disappear.
Thanks to #Javi for provided with alternative method.
For Step 2 & 3, ln -s jbr jre also can get the job done. And I think this is the best method to do.
Here is a little fuller answer for everything I had to do to get Android Studio set up on my M1.
Install Android Studio to the Applications folder
Create a symbolic link to from the jre folder to a new jdk folder. (Due to this bug)
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
Set the JAVA_HOME environment variable
nano ~/.zshrc
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home"
source ~/.zshrc
Install Android SDK Command-line Tools (needed for accepting license)
At this point it should work now (assuming you've also added flutter to your path)
flutter doctor
This is the Windows fix, and it appears to work for me. I am using Android Studio2022.1.1.19
First, right-click the Android Studio icon and open the file directory(location). Your installation folder should be at "C:\Program Files\Android\Android Studio".
When you are already at the Android Studio installation root folder, you will see two folders: "jbr" and "jre".
Copy all the files inside the "jbr" folder to the "jre" folder, then try it again.
Note: This fix is working on my end; just comment down below if it didn`t work on your end.
I did install a fresh version of JAVA SDK, flutter, Android Studio and run the below command directly on the terminal one by one to fix 'Unable to find bundled Java version. ' issue.
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
flutter doctor -v
Now, you should be able to see the error is disappeared in flutter doctor description in terminal.
Run Flutter doctor, if there´s an error indicating that the java bundled can´t be found (specially if you have Android Studio version Artic Fox), run this commands if using Mac:
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
Flutter Doctor
This solution is for M1 Mac User
Find your local Java version by typing /usr/libexec/java_home -V. If didn't exist, install the latest ARM Java version here
Set Java_Home path (in my case jdk-17.0.1.jdk) by typing /usr/libexec/java_home /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
Type all of these in terminal
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
Finally run flutter doctor -v to see all the details changes
In my case, on a macOS Ventura with Intel processor, I had to follow the steps below in order to make Flutter work after upgrading Android Studio to Electric Eel:
cd /Applications/Android\ Studio.app/Contents/
ln -s jbr jre
flutter config --android-studio-dir /Applications/Android\ Studio.app/Contents
Step 3 was important, without it flutter doctor --android-licenses would always fail...
I had the same error after updating Android Studio to 2020.3.1 Patch 3 (on MAC).
After upgrading Flutter from 2.2.2 to 2.5.3 problem was solved.
I also installed "Android SDK Command-line Tools". It's installation is explained here: https://stackoverflow.com/a/68492909/6839552
The accepted solution worked with a slight modification for me. I had to add the -f (or use --force) option to make it work (this is because ln failed with file exists and I kept ignoring that - the existing file must have had a problem).
cd /Applications/Android\ Studio.app/Contents/jre
ln -s -f ../jre jdk
ln -s -f "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
flutter doctor -v
I'm running macOS Monterey
Perhaps the simplest option (MAC):
Navigate to: cd /Applications/Android\ Studio.app/Contents/jre
Create a directory: mkdir jdk
Create a soft link: ln -s Contents jdk/Contents
COPY folder
/Applications/Android Studio Preview.app/Contents/jre/Contents
to
/Applications/Android Studio Preview.app/Contents/jre/jdk/Contents
It's #crzorz 's additional answer worked for me. "YOUR_PATH/flutter/packages/flutter_tools/lib/src/android/android_studio.dart". At the bottom of the file, you'll see lines similar to "globals.fs.path.join(directory, 'jre', 'jdk', 'Contents', 'Home')" which #crzorz mentioned.
These lines clearly show on MacOS (old and new versions) and other OS how "flutter doctor" finds the so-called bundled Java.
I use Android Studio Electric Eel. What I did to fix the issue was "create a symbolic link named jre pointing to jbr". Because folder jbr (JetBean Runtime) has the java.exe and other Java Runtime files, but flutter doctor still tries to find a folder named jre.
Update to:
Android Estudio 2022.1 Electric eel + Java 19 + VS Code + Windows 10 x64
Before: Make sure you have JAVA_PATH correctly
1 - Run CMD as Administrator [Not POWERSHELL, because mklink only work for CMD]
2- Run the mklink /d "C:\Program Files\Android\Android Studio\jre" "C:\Program Files\Android\Android Studio\jbr"
3- Run command flutter doctor and Problem solved, but then apears the licenses problem, so
4- Run command flutter doctor --android-licenses wait and accept all
Other way doesn't work, thrown a error: " bla bla bla...already exist..." why?
Because the structure of mklink command: mklink [OPTIONS: /d /j /h rd del] "Path+Name folder/file you want {jre}" "Path+Name folder/file linked {jbr}"
Traduced to human language: Make a Symbolic link [mklink /d] "there with the name jre" to the folder "that is there with the name jbr"
Make sure to use "double quotes" for the files paths and say "please" and not "Just do it" (cmd smell your hurry).
If you dont do it like this, will have problems with sdkmanager and launch devices, because the new Android Estudio don't use jre and that's why many android devices don't launch, and have the 60 second problem.
Copying all contents of JDK and pasting it into a JRE file, worked for me.
After that, I updated my ENV path.

How to install android SDK tools without installing Android studio on ubuntu?

I was trying to install Android SDK with the help of the SDK command line tools downloaded from the link https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip on my Linux Ubuntu 16.04 PC.
i run the command following command for installation
./android update sdk
sudo ./android update sdk
but getting the this
error
how to solve this error ?or suggest me a proper way to install build tools.
FYI
and also i read that ~/.android should contain androidtool.cfg file which has below data in it.
http.proxyPort=proper_port
http.proxyHost=Proper_proxy_ip
sdkman.show.update.only=true
sdkman.ask.adb.restart=false
sdkman.force.http=true
It says that android script is deprecated, so you must use $ANDROID_HOME/tools/bin/sdkmanager --update for update all the installed packages, and $ANDROID_HOME/tools/bin/sdkmanager --list for see a list of installed, updates and available packages.
See more options at: https://developer.android.com/studio/command-line/sdkmanager.html or with $ANDROID_HOME/tools/bin/sdkmanager --help
$ANDROID_HOME refer to the location of your Android SDK. by example:
export ANDROID_HOME=$HOME/android/sdk

Android Hello-World compile error: Intellij cannot find aapt

I'm trying to get set up with an Android development environment using IntelliJ in Ubuntu 12.04. I create an Android Application Module, but when I try to build, I get the following error:
android-apt-compiler: Cannot run program "/home/jon/Programs/android-sdk-linux/platform-tools/aapt": java.io.IOException: error=2, No such file or directory
Several hours of scouring the internet hasn't helped.
By the way, I ran locate aapt in the terminal and found that aapt is located at /home/jon/Programs/android-sdk-linux/build-tools/17.0.0/aapt
It appears that the latest update to the r22 SDK release moved aapt and the lib jar from the platform-tools to the build-tools directory. While we wait for JetBrains to release an update, here's a quick fix using a couple of symbolic links:
From your AndroidSDK/platform-tools directory, run the following:
ln -s ../build-tools/17.0.0/aapt aapt
ln -s ../build-tools/17.0.0/lib lib
...and IntelliJ should be able to compile as normal.
update your IntelliJ to 12.1.4 by using beta releases as the update channel
In Windows it is enough to copy only aapt.exe, lib\dx.jar and dx.bat
from build-tools\android-4.2.2
to
platform-tools
The same problem occurred for me with android-studio. But, this probably applies to the IntelliJ IDE as well.
When checking the file location I saw, however, that aapt was in the expected location.
In my case the issue was that I was running a 64-bit Ubuntu linux system which cannot execute the 32-bit aapt executable.
Installing 32-bit compatibility libraries solved this issue in my case: sudo apt-get install ia32-libs
i solve it with this to line commands
ln -s ~/Programs/android-sdk-linux/build-tools/17.0.0/aapt ~/Programs/android-sdk-linux/platform-tools/aapt
ln -s ~/Programs/android-sdk-linux/build-tools/17.0.0/lib ~/Programs/android-sdk-linux/platform-tools/lib
I also noticed it.
ADT has been updated and they added this new build-tools where they moved everything.
Intellijidea is not updating paths so it's searching aapt in the old path.
I don't know how to solve it, so let me know if you find a solution...
UPDATE:
I think that you have only 2 options:
1) Use Android Build studio: http://developer.android.com/sdk/installing/studio.html
2) Copy (this is dirty but works) all content from build-tools/17.0.0/ to platform-tools/ and it will build
To complain to Jetbrains, go here: http://youtrack.jetbrains.com/issue/IDEA-107311
I reckon more votes will be a faster fix.
Thanks for the tip! On a mac running the Android 4.2.2 SDK, this worked great. You'll just need to update your paths accordingly. E.g.
ln -s ../build-tools/android-4.2.2/lib lib
ln -s ../build-tools/android-4.2.2/aapt aapt
I ran into this issue but with android-maven-plugin
and as a variant of your item #2 rather than copying the file(s) I simply created a symbolic/soft link for aapt
cd platform-tools
ln -s ../build-tools/17.0.0/aapt ./
This approach seemed to get all my builds functioning again.
Clone the android-maven-plugin on GitHub and install it in your repo
git clone https://github.com/jayway/maven-android-plugin.git
cd .../maven-android-plugin/
mvn clean install
Then update your pom to use version 3.5.4-SNAPSHOT of the plugin.
Everything should work properly !
I ran these three commands and my problem was resolved
mklink "%ANDROID_HOME%\platform-tools\aapt.exe" "%ANDROID_HOME%\build-tools\17.0.0\aapt.exe"
mklink /D "%ANDROID_HOME%\platform-tools\lib" "%ANDROID_HOME%\build-tools\17.0.0\lib"
mklink "%ANDROID_HOME%\platforms\android-17\tools" "%ANDROID_HOME%\build-tools\17.0.0\aidl.exe"
If you haven't set ANDROID_HOME Environmental variable the replace %ANDROID_HOME% with the path to your android SDK e.g. C:\Android\android-sdk
On Mac OS you need to
$ cd platform-tools
$ ln -s ../build-tools/android-4.2.2/aapt aapt
$ ln -s ../build-tools/android-4.2.2/lib lib
Goodlife once again.
Just incase of such an error clean project and you are good to go.

Categories

Resources