Newly installed Flutter. When trying to run flutter doctor or creating a new project with Android Studio (plugin and dart installed), Flutter exits unexpectedly. Flutter folder/install is in /opt and path was added to .profile. Would it be better to install/move flutter to a user location? Android Studio is in /opt.
FileSystemException: FileSystemException: Cannot open file, path = '/opt/flutter/bin/cache/lockfile'
(OS Error: Permission denied, errno = 13)
Resolved with permissions update (also moved to home directory prior to permissions change).
Related
I recently installed Android Studio on Ubuntu (WSL) for my Meteor project but it installed to /opt/android-studio. I see that the SDK is installed to /root/Android/Sdk. I've added it to the ANDROID_SDK_ROOT env variable but it says its a non existent path.
How should I be setting these paths? This is the output I'm getting:
Status of the individual requirements:
✓ Java JDK
✗ Android SDK: 'ANDROID_SDK_ROOT' environment variable is set to non-existent path:
/root/Android/Sdk
Try update it manually to point to valid SDK directory.
✗ Android target: Command failed with EACCES: avdmanager list target
spawn avdmanager EACCES
✓ Gradle
I have set the JAVA_HOME path to:
/usr/lib/jvm/java-11-openjdk-amd64
JAVA_HOME should be something like /usr/lib/jvm/java-11-openjdk-amd64
There are no sdks because you need to populate using or android studio or something like the sdkman command line utility
Moving the Android directory to /etc solved it:
sudo su
mv /root/Android /etc
I'm not able to run my meteor app on Android as the Android target command failed. Could this be a permissions issue somewhere? The Android SDK installed to /root and I moved it to /etc, could that be part of the problem?
Why does this command fail and how can I resolve this?
$ meteor add-platform android
android: added platform
Your system does not yet seem to fulfill all requirements to build apps for Android.
Please follow the installation instructions in the mobile guide:
http://guide.meteor.com/cordova.html#installing-prerequisites
Status of the individual requirements:
✓ Java JDK
✓ Android SDK
✗ Android target: Command failed with EACCES: avdmanager list target
spawn avdmanager EACCES
✓ Gradle
These are my paths set in my .bashrc file which I'll tidy up later:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export ANDROID_HOME=/etc/Android/Sdk
export ANDROID_SDK_ROOT=/etc/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/build-tools
export PATH=$PATH:$ANDROID_HOME/cmdline-tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
export ANDROID_BIN=/opt/android-studio-2021.2.1/android-studio/bin
Problems that needed resolved:
1 - Android SDK and Studio was installed as root, changed owner to $USER:$USER
2 - /dev/kvm permission denied. changed this to 777 which I know is bad so I’ll need to look at that again
3 - Path issue with cmdline-tools, had to add /latest/bin so the line in my .bashrc file is:
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
This happens because you didn't configure correctly your PATH for Android Studio.
Check the documentation here: https://guide.meteor.com/cordova.html#installing-prerequisites-android
I am trying to build a ionic project in Android studio on Ubuntu 20.04 . I am using the command ionic capacitor build then android studio opens up as expected then it shows this error Gradle sync failed: Sync failed: reason unknown. I am unable find a solution for this particular gradle sync error. I have reinstalled Ubuntu and other things but still the problem persists.
In my case, a fresh install of Android Studio resulted in Android 31 being the only SDK available but the project was targeting Android 30. I went to Tools > SDK Manager and made sure the appropriate version of Android SDK was installed and available. After restarting, and allowing the gradle sync to complete I was able to build/run the app on a virtual device, etc.
Here is what I found
This is the screenshot thanks for helping.
Capacitor lets you manage your own Android project. Like any IDE-backed project, sometimes things get so out of sync that the only solution is to rebuild the project.
To do this, follow these steps:
Copy any source code you created (such as Java files in app/android/src, manifest files, or resource files) into a safe location outside of app/android.
Next, make sure you are running an updated version of the Capacitor CLI:
npm install #capacitor/cli#latest
Remove the android directory:
rm -rf android/
Re-create the Android app from Capacitor:
npx cap add android
Copy your saved source files back into the project.
Check the error log. You should find something like "Module: 'mobile' platform 'android-30' not found" or something similar. Click Tools > SDK Manager and download the appropriate Android SDK Platform package.
on top right you will see option to view log file upon clicking there you will redirect to file manager and open idea file there
example :
open idea file and scroll down you will see actual issue.
In my case android sdk 31 was not installed.
I installed android sdk 31 from File>Settings>Apprearance and behaviour>system settings>android sdk and install required android sdk and rebuild the project.
accord to my observation in most cases you get this error because you have not required sdk installed in your system.
I'm creating a new flutter project in Android studio. I give the project a name and choose Flutter application. I then clicked finish and then nothing happened.
Android studio says that
"Flutter create command was unsuccessful"
When I navigate to command directory using file explorer, a new folder is created with the project name I've given but it is empty.
Please help.
A simple Android Studio restart did the trick for me
I've solution to this problem now.
After running flutter doctor --android-licenses I got to know that I need to update my sdkManager.
Then I went to that directory using
cd C:\Users\[user-name]\AppData\Local\Android\Sdk\tools\bin
and run sdkmanager --update
Then I restarted the Android Studio and tried creating flutter project.
It worked.
check your FLUTTER SDK path of the project (android studio: file -> settings -> Language & framework -> flutter -> flutter sdk path) . Or execute flutter doctor command in flutter consol.(This worked for me)
please install all the dependencies that flutter wants
Operating Systems: Linux (64-bit)
Disk Space: 600 MB (does not include disk space for IDE/tools).
Tools: Flutter depends on these command-line tools being available in your environment.
*bash
*curl
*file
*git 2.x
*mkdir
*rm
*unzip
*which
*xz-utils
*zip
Shared libraries: Flutter *test command depends on this library being available in your environment.
libGLU.so.1 - provided by mesa packages such as libglu1-mesa on Ubuntu/Debian and mesa-libGLU on Fedora
Look at Flutter sdk path while Creating the Project.
$ C:\flutter
If your Flutter SDK is updated and the path is right you will get a solution.
Check your Flutter SDK path.
Check the package name. It must be in lower case.
Restart your IDE and check again.
On Android Studio 2.2.3 when I am creating a new project or opening previous projects then the following pop ups:
Gradle sync started 7:55:26 AM Gradle sync failed: Cause: error=13,
Permission denied
Consult IDE log for more details (Help | Show Log)
what should I do? Please help. This is important.
On Android Studio folder, do
chmod 777 * -R
I think this not the best answer but it worked for me.
I solved this by going to the directory that contained the android-studio folder, which in my case was /usr/local
i.e cd /usr/local
then I ran:
sudo chmod 755 -R android-studio
It even fixed my font not displaying properly.
I'm using ubuntu 18.04
go the log files & see the issue. Most of the times it will access denied to jdk. Try changing the java path from android inbuilt jdk to any other version and refresh the project