Unable to accept android licenses while running flutter doctor - android-studio

Well when i am trying to accept android license on command prompt by typing "flutter doctor --android-licenses" this error appears everytime
" Exception in thread " main" java.Lang.NoclassDeffounderror:javax/xml/bind/annotation/xmlschema"
How do i solve this error

Open your cmd (not from android studio terminal)
run flutter doctor --android-licenses
press y to accept every license.
If it didn't work, try this command: (at the cmd too)
"android sdk path"\tools\bin\sdkmanager --licenses

Related

How to solve "target died before we could attach" message in Flutter console?

i am new to android app development, i just started learning flutter and there is so much information to take in , i downloaded a project from github to try and make sense out the things that i only read about online and when i run the app this is what i get :
Screenshot1
Screenshot2
in the red boxes you can see there is a lot of things saying " target died before we could attach " what exactly is this ? is it something to be concerned about ? i tried googling it to see if i find some information about em but i couldn't find anything useful , maybe i was searching it the wrong way ...
Update: After running the "flutter doctor" this is what i got :
C:\src\flutter\flutter>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.19042.631], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.52.0)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
! Doctor found issues in 3 categories.
but i am sure that i have installed the flutter and dart plugin
I have no idea what causes this error but this is how I resolved mine.
Confirm that flutter doctor generates no errors.
Uninstall any versions of the application from your emulator.
flutter run
Now you should be okay.
From a console window that has the Flutter directory in the path, run the following command to see if there are any platform dependencies you need to complete the setup:
C:\src\flutter>flutter doctor
This command checks your environment and displays a report of the status of your Flutter installation. Check the output carefully for other software you might need to install or further tasks to perform
source here
# Edit
If the doctor command does not indicate an error, then try to create a new project and copy and paste the classes from the project you downloaded to your new project. Flutter need to download the Gradle, it may be some IDE bug that can be solved by creating a new project

FLUTTER ALREADY INSTALLED! but still shows "Flutter plugin not installed; this adds Flutter specific functionality"

FLUTTER and DART ALREADY INSTALLED! but still shows "Flutter plugin not installed; this adds Flutter specific functionality"
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
Appreciate your helps.
Just run this in the command line
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1
... it worked for me... sorry I have no explanation , I got it from this link in stack overflow ...
Flutter plugin not installed error;. When running flutter doctor (answer 40)! hope it works for you.
Try to run the following commands:
step 1 : run> flutter channel dev
step 2 : run> flutter channel updrade
step 3 : run > flutter config --android-studio-dir="E:\Android Studio"
at step2
PS C:\Users\Administrator\Desktop> flutter channel upgrade
Switching to flutter channel 'upgrade'...
This is not an official channel. For a list of available channels, try "flutter channel".
git: fatal: 'origin/upgrade' is not a commit and a branch 'upgrade' cannot be created from it
Switching channels failed with error code 128.
but it doesn't matter
when i try “flutter doctor” ,there are no issues.
thanks

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. problem on flutter

FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\emre\AppData\Local\Android\sdk
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 11s
FAILURE: Build failed with an exception.
What went wrong:
Could not update C:\Users\emre.gradle\caches\5.6.2\file-changes\last-build.bin
C:\Users\emre.gradle\caches\5.6.2\file-changes\last-build.bin (Access is denied)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 11s
Exception: Gradle task assembleDebug failed with exit code 1
Apparently you should accept the license,so in your command promp:
cd /d "%ANDROID_SDK_ROOT%/tools/bin"
and then
sdkmanager --licenses
just accept the license and the error should goes away.
Here is the main problem
Failed to install the following Android SDK packages as some licenses have not been accepted. build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-28 Android SDK Platform 28
As the error suggests, first accept all licenses by running the following command
flutter doctor --android-licenses
next head over to https://androidsdkmanager.azurewebsites.net/Buildtools and download the build tool that corresponds to the one you are missing in this case 28.0.3 After downloading extract the zip file into C:\Android\Sdk\build-tools\28.0.3 if you are on windows and /Library/Android/sdk/build-tools/28.0.3 if you are on mac
finally, download the missing Android SDK platform 28 from https://androidsdkmanager.azurewebsites.net/SDKPlatform and unzip it into /Library/Android/sdk/platforms/android-28 if you are on mac or C:\Android\Sdk\platforms\android-28 if you are on windows
Run your project (flutter run) and enjoy
Try running flutter doctor on cmd. If it shows:
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19042.685], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.52.0)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (0 available)
Then run flutter doctor --android-licenses,
and accept all the license agreement. The problem must be solved then.
go setting
android SDK
SDK Tools
and then
click show package details
and Android SDK Build-Tools
Download 28.0.3
Apply and ok :)
In my own case, Deleting .gradle folder solved the problem. Just head-on into your usual project dir and navigate into android and you'd find .gradle folder waving a hand in there. I hope this helps somebody out there. But make sure you have done
flutter doctor --andriod-licences
Don't do anything, like changing the SDK path or updating tools.
At first, what you should try to do is this:
Remove your physical device from your machine which is connected via USB and instead of the physical device, run your application on a browser (I suggest Chrome) and if there is no other issue then you will find the error will have been tackled. So I am saying that the problem is neither in the path nor in the software or code. Please try this suggestion first, because I wasted a full day trying to tackle this problem!
We just need to install proper Android version manually
Go To SDK Manager
Android SDK
Uncheck Installed Version
Manually Install Android version which it tried and throwing error for(see in error message)
Apply and OK
Restart
It worked for me.

Error setting up flutter for the first time

I am having an issue getting flutter doctor to set up or create flutter projects in Android studio. I get the following error when I try to run flutter doctor.
ProcessException: ProcessException: The system cannot find the file
specified.
Command:
C:\Users\Joshua\AppData\Local\Android\Sdk\tools\bin\sdkmanager.BAT --licenses
I already did the steps in this link:
How to accept licenses with flutter doctor?

<Flutter> emulator launched but not detected by android studio

I'm a beginner in Flutter and I've an emulator opened/powered on and android studio doesn't detect it.
Hence I can't run any program because "no device is running". I've tried installing 'Android emulator' in the SDK tools but android studio still cant detect it.
Android Studio device list shows "loading" and no devices connected. Thus, I opened emulator but I cannot run flutter on emulator on Android Studio. After 5 hours I found that the reason is the new Flutter version.
I solved with choose different version of Dart and Flutter!
You need to download 1.17.3 version. Quick download link: Dowloand Flutter SDK 1.17.3 Version
And switch Stable Channel & Dart: 2.8.4, this is important. Also, if you want, you can check all versions of Flutter SDK: Flutter Versions
On MacOS, just write terminal: flutter channel stable
Note: If this answer is not working for you, you can open android module of your flutter app in Android Studio. It can be helpful when you try to add Firebase skills.
I had same problem.
CMD: flutter devices
No devices detected.
CMD: device emulators
Device emulator-5554 is offline.
In Android virtual device manager, I cold boot emulator and it started working.
In a windows platform I did:
If you have ran flutter doctor and there is no issues and if you can run your flutter app in cmd or using VSCode:
Just try to open Android Studio or IntelliJ as administrator by right clicking on the icon. This may list down devices and solve your problem.
The reason may be you have cloned flutter repository or you don't have right permission in flutter installed directory.
Run flutter doctor command to check whats the problem.
In terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.
Check your flutter plugin whether it is up to date.
And read this flutter run: No connected devices , You may find the solution.
For me (on a Mac) I had the Android SDK installed in a custom location so I needed to set the ANDROID_HOME environment variable. In the terminal you can check what this value is with:
echo $ANDROID_HOME
I added the Android SDK to my .bash_profile (might be a different file if you are using Linux or Windows) for both ANDROID_HOME and PATH.
# already had these
export PATH="$PATH":"/opt/android-sdk/tools"
export PATH="$PATH":"/opt/flutter-sdk/bin"
# added this
export ANDROID_HOME="/opt/android-sdk"
Replace /opt/android-sdk with wherever yours is.
Then I updated the variables with
source .bash_profile
Testing with flutter doctor showed it was working.
flutter doctor
I restarted Android Studio and the emulator worked.
The last version of Flutter 1.17.5 (release the 2th, July) solved this issue for me.
Just flutter upgrade
run Flutter doctor to make sure you install everything.
run Flutter devices to see whether it is detected by flutter or not.
if you can find the your emulator there run flutter run -d <YOUR_EMULATOR_ID>
if you unable to find your emulator there may be you have to accept the android licenses . run flutter doctor --android-licenses to accept.
run flutter emulators to see list of emulators you have.
run flutter emulators --launch <emulator id> to launch
run Flutter devices to check whether emulator is detected by flutter or not.
run flutter run -d <YOUR_DEVICE_ID>
What worked for me is, updating Android Emulator.
Visit SDK Manager
Check whether any updates available for Android Emulator
If available, install the newest version
Hope this would be helpful!!!
I had this issue on Android Studio.
I had an emulator but it was not recognized even though the emulator was open.
I got around this by launching developer mode inside of the actual emulator by following the steps in this link: https://tweaklibrary.com/how-to-enable-developer-mode-on-android/#:~:text=How%20to%20Enable%20Developer%20Options%20On%20Android.%201,one%20of%20the%20most%20powerful%20...%20More%20items
After setting the emulator to developer mode, the emulator phone appeared as an option and when I ran the flutter hello world it appeared on the emulator.

Resources