On Android Studio, I clone this flutter project. When prompted if I want to create a project for the sources downloaded, I click no. Then I click "open existing project", and select the project just downloaded.
Android Studio tells me that "Pub get has not been run". So I click "Get dependencies":
C:\src\flutter\flutter\bin\flutter.bat --no-color pub get
Running "flutter pub get" in dicee-flutter2... 3,0s
Process finished with exit code 0
After this, the highlighting in the code is corrected, so I guess the project recognizes flutter now. But the "Pub get has not been run" prompt never disappears.
Then I run my project, in order to see it in the virtual device, but I get the following error:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
--output directory is required for assemble.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 896
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 2s
Exception: Gradle task assembleDebug failed with exit code 1
The output of flutter doctor is:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 1.20.0-3.0.pre.78, on Microsoft Windows [versão 10.0.18362.356], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[√] Android Studio (version 4.0)
[√] Connected device (1 available)
• No issues found!
How to fix that, so I can see the project on the virtual device and stop getting the "Pub get has not been run" prompt?
There is a setting in AS to set the output directory. From memory it's in the file | project settings menu.
This is possibly a separate issue to the pub get problem.
You can just run flutter pub get from the cli in the projects root directory.
Related
I am using android studio to run flutter project, now i can not run any project and i get the same error every time:
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-29 Android SDK Platform 29
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\moham\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 29s
Exception: Gradle task assembleDebug failed with exit code 1
it seem you did not accepted all licences after install.
Try to run this:
flutter doctor --android-licenses
and then press y every time it ask, to accept the licence
seems like duplicate of this
you should delete config Android studio folder and reinstall that whit all requirements.
C:\Users[your name folder]
Recently installed flutter sdk, Android studio 4.1 and Flutter and Dart plugins for both VSCode and Android studio. Running flutter doctor gives me the following
[√] Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 10.0.18363.1198], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] 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.
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
A similar question has been asked Flutter Doctor, Flutter & Dart plugin not installed which says its a bug in the 4.1 release, but the github repo says the bug has been fixed and to ignore the warning.
I've tried:
1)Disabling and Re-enabling the plugins
2)Reinstalling the plugins
3)Reinstalling both VSCode and Android Studio
4)Checking if the plugins are installed in the right place
5)Executing it on another emulator and device
When i execute
import 'package:flutter/material.dart'; //for materials
void main() {
runApp(MaterialApp(
home: Container(
color: Colors.purple,
),
));
}
This is the output i get in the debug console:
'attrib' is not recognized as an internal or external command,
operable program or batch file.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 677
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'cmd'' finished with non-zero exit value 1
* 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 28s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Solution:
Browse to the environment variable setting and update PATH variable to contain address for your System32 folder.
i.e C:\Windows\System32
After adding the variable, restart your computer.
It will fix the error.
Reason: This problem occurred because the system didn't found the 'attrib' file.
I had to reinstall my windows and so I had to freshly install Android studio, flutter sdk and everything.
After completing all my installations I am unable to run my project. Before upgrading the system my project was working all fine with 0 errors.
Flutter doctor:
C:\Users\Admin>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18362.959], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Android Studio (version 4.0)
[√] Connected device (1 available)
• No issues found!
Error:
Launching lib\main.dart on Mobile in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':agora_rtc_engine:extractDebugAnnotations'.
> Could not resolve all files for configuration ':agora_rtc_engine:lintClassPath'.
> Could not download kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.6.3)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.6.3/kotlin-compiler-26.6.3.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.6.3/kotlin-compiler-26.6.3.jar'.
> dl.google.com
> Could not download uast.jar (com.android.tools.external.org-jetbrains:uast:26.6.3)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.6.3/uast-26.6.3.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.6.3/uast-26.6.3.jar'.
> dl.google.com
> Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15)
> Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
> Could not GET 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
> jcenter.bintray.com
* 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 1m 46s
Exception: Gradle task assembleDebug failed with exit code 1
This is the first time I am moving my project from my original system to this new one.
I don't have enough reputation to comment so I will write it as an answer. Since it is the first time running the app, make sure you have an internet connection so it can download the required files.
Solution:
As of now what I have done is the following:
agora_rtc_engine that was showing up as error I have removed it. (I will be re-adding this package as this is required for my app)
java jdk download i have added I was getting error on keytool to generate SHA1 Key Fingerprint.
I updated my SHA1 Key Fingerprint in Firebase. I have to do this as I was getting error when login in using Google sign-in.
Now my App is working fine with no errors.
This might not be the correct solution for the issue, so feel free to give your suggestion on the above error that I had faced.
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.
I'm learning React Native and all of sudden my Android build has started to fail. When I type the command 'react-native run-android' the build fails with following error
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring project ':app'.
java.lang.NullPointerException (no error message)
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 1s Could not install the app on the device, read the
error above for details. Make sure you have an Android emulator
running or a device connected and have set up your Android development
environment:
https://facebook.github.io/react-native/docs/getting-started.html
I have closed and re-opened the terminal, emulator, and Android Studio and made sure that the emulator is running before typing the command. But the build still fails. However if I go into Android Studio and click the 'Play' button (Run App), and the build succeeds and my App is displayed on the Android emulator.
I have also tried copying my project to another folder and all of the same errors still occur. Not a pressing issue, more just of an annoyance so if you have any suggestions that'd be great :)
Same error occurs for me when i change gradle version in build.gradle file.
This error of NullPointerException occurs when the version in build.gradle does not match the version installed in your project root folder.
Then change to the same version resolved the error.