i have completed all the steps like creating keyStore , changing in build.gradle etc.
but i am facing a issue while running this command
flutter build apk --release
whenever i run this command terminal shows that
I am using Linux
flutter: command not found
Have you added installdirectory/flutter/bin to your path variables?
Can you Give us a little more context, like , are you on Windows or mac or Linux?
you should locate flutter in path click here
Related
I need to set 2 main files for test and dev environment. When I try to run
flutter run -t test_app/lib/main.dart
I get following errors:
AndroidManifest.xml could not be found.
Please check ***/android/app/src/main/AndroidManifest.xml for errors.
No application found for TargetPlatform.android_x86.
Is your project missing an android/app/src/main/AndroidManifest.xml?
Consider running "flutter create ." to create one.
And when I use:
flutter build apk -t test_app/lib/main.dart
I get:
[!] Your app is using an unsupported Gradle project. To fix this problem, create a new project by running `flutter create -t app <app-directory>` and then move the dart code, assets and pubspec.yaml to the new
project.
I add the configuration to run this 2 different main files and it works but I need to run this from command line and that's the problem.
I saw similar issues and I tried
run flutter clean and flutter pub get
What can cause this issue? Any ideas how to resolve this?
You can check this reference
Try to fix it by deleting the app.apk in the build/app/outputs/apk.
Try deleting this Flutter project and create a new Flutter project.
Excuse me guys, I'm sorry. I want to ask, can I install flutter on my Android Mobile ?? I tried to search on Google but the results failed, from trying to install on Termux but failed, try to install on VHEditor but the problem is I can't install flutter SDK in Environment Variable. maybe you guys can answer my question.so, can i build flutter apk in android mobile??
I am assuming you meant building an apk version of the app instead of running it on an emulator.
To do that run in your IDE terminal or flutter console
Flutter build apk
I guess there is no way of installing Flutter on phone, The best way to use flutter on phone is to ssh into a server and compile it's apk
yes we can build flutter apps in mobile through termux and here is simple guide for reference but i am still giving simple one liner installing command but for "how to use" please check reference link
curl -s https://raw.githubusercontent.com/Hax4us/flutter_in_termux/master/install.sh | bash -s
reference : https://www.hax4us.com/2021/12/install-flutter-in-termux.html?m=1
When i try to implement scoped model, i get this error message:
[flutter_course] flutter packages get
Running "flutter packages get" in flutter_course...
Creation of temporary directory failed, path = 'C:\Program Files\flutter.pub-cache_temp\dir' (OS Error: Access is denied.
, errno = 5)
name: flutter_course
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
scoped_model: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
What worked for me is: flutter pub cache repair
reference
I FINALLY GOT THE SOLUTION
Hello guys I finally found a solution to this error.
So the problem is first caused because temporary files could not be created in the /bin or .pub-Cache
To fix this go to their respective folders which are in the flutter folder and the first start with the bin folder and change its security options to allow for ALL APPLICATION PACKAGES and then the .pub-Cache the same .
Run flutter doctor and if you get a license error just follow the steps given by flutter doctor and you are good to go.
Try to clean Flutter: flutter clean and then update pub with: flutter packages upgrade or update Flutter with: flutter upgrade.
This happens to be an active issue and the flutter team is currently working on it. The problem is specific to the Windows operating system. You can try the following workarounds for now:
1) Make sure your installation does not reside in any directory which requires special privileges like Program Files. If that's the case, you can try running it as admin for now but you should change your installation directory to a user's data directory as soon as possible (#Günter Zöchbauer has already pointed this out in the comments).
2) Try restarting your machine.
3) Try deleting the .dart_tools folder and also try clearing the cache in flutter/bin/cache
4) Try disabling your antivirus and/or windows defender temporarily (although it's not really possible for people working on corporate machines). This issue could have been caused by an active antivirus locking your files temporarily.
Enable in your windows settings the Developer Mode.
An easy solution that worked for me on Windows was to run Android Studio as administrator.
After that, the error no longer appeared.
If you have tried all answers here.
You should try this, it worked for me.
(in android studio) Delete the pubspec.lock file in your project.
(in android studio) Execute this-- Tools > Flutter > Flutter clean
Go to flutter sdk folder where you have downloaded it. In my case C:\src\flutter\
Run this below command.
C:\src\flutter\bin\cache\dart-sdk\bin>flutter pub cache repair
After completion run pub get again in your android studio. It should work.
Turning on developer mode solved my issue on Windows 10.
Delete temp folder in pub cache.
Do pub repair flutter pub cache repair.
Turn on developer mode in windows settings.
Flutter clean and delete pub.lock if exist.
Try flutter pub get.
This worked for me.
Because I switched the Flutter version, the following operation worked for me
flutter clean
flutter pub get
Update the Flutter sdk using : flutter upgrade.
And also scoped_model in this link scoped model is showing dart 2 incompatible
You get this error because "packages get" command attemp to delete file in ...flutter.pub-cache_temp. Delete files manually in this loction, this is may not perfect solutions but it's works.
Sometimes newly installed packages could cause this. Uninstall and install package again
I downloaded flutter sdk and extracted file in C:\FlutterDev\ and then start android studio
remember to provide flutter sdk path if you changed
I had a similar situation when I upgraded the flutter version to the new 2.2.
As a solution, I ran the command line as administrator (or terminal for linux users) in the Project folder and run the following commands:
flutter pub cache repair
2.flutter pub get
I have tried all the solutions mentioned above none worked for me.
Then I went to file(any .dart) which has dependency error then click on get dependency. it works for me.
I have tried
Flutter clean X
Flutter pub cache repair X
Add Security X
Delete Temp X
last ....
I just open the windows setting developer mode O
My solution was to run
flutter pub get
it in an external terminal not from android studio
Also I set windows as developer, I ran in terminal and turned developer mode on
start ms-settings:developers
not sure which one helped.
try this, it solved my error,
terminal->flutter clean, then flutter pub get after this you will get the reason for error ,
in my case i was using latest version of path dependencies(path ^1.8.3) but sdk depended on path ^1.8.2,
so i changed path dependency from path ^1.8.3 to path ^1.8.2, in pubspec.yaml and error solved...
In my case it was anti-virus, I turned it off for a few minutes it started working.
I'm using Ubuntu Gnome 14.04 64 Bit (for the moment) with kernel 3.19.0-33-generic.
I created a new app (a clean one, no plugin, no www folder with content) to try to build it.
After type in the bash "cordova build android"
I get this error:
Running command: /home/aby/Desktop/testApp/platforms/android/cordova/build
[Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.]
ERROR building one of the platforms: Error:/home/aby/Desktop/testApp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/aby/Desktop/testApp/platforms/android/cordova/build: Command failed with exit code 2
Now if you printenv | grep android
You will get
ANDROID_HOME=/opt/android-sdk-linux
ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform-tools
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/home/aby/bin:/home/aby/opt/jdk8/jdk1.8.0_45/bin:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools
ANDROID_SDK=/opt/android-sdk-linux
You can see that the variables exist, in fact before I run cordova build android I had to use cordova platform add android and its works with no problem.
So I found this Bug, and tried some solution like update android(project) or remove and install it again with no success.
I reinstall the Andoroid SDK, and updated the "/.bashrc", "/.profile" and "~/.pam_enviroment" with the environment values and also this not help.
So how can I fix this? How can I build my app with no error? What I missing?(If you consider that you need another information please tell me).
Thanks, in advance.
At the end I could fix my problem when I change the "Owner" / "Group" to the android sdk folder and Permission to "/tools/android".
Here a link to my previous question, and the solution (at least for me) to fix this error.
When I try to upload an application to Android Play store I get the following error:
ERROR: dump failed because no AndroidManifest.xml found
Steps that I took:
new HDD, install clean jre, jdk
download Android eclipse bundle - latest version today
make a new project, sample. simple hello world
sign it with the wizard, create a certificate etc.
try to upload it on the market...=ERROR!
I tried many combinations, different eclipse versions. Even to sign it manually. It doesn't work.
If I try to run aapt dump badging I get the same error.
Just write in the terminal
flutter clean
Just delete app.apk file from: /build/app/outputs/apk/app.apk.
Visual Studio will create a new correct app.apk file.
I dont know o 'why' of this.
I faced this problem using Visual Studio Code in a Flutter project and Im posting my solution because it can help others.
I just run 'Flutter Clean Project' and then I run the project.
All works again!
In my case the problem was with the filename: I accidentally (subconsciously) renamed it to .apk, when it should be .aab 🤦
following points are need to be taken care of while uploading file on
android market
"android:versionCode" attribute from AndroidManifest.xml is proper.
"android:versionName" attribute from AndroidManifest.xml is proper.
The package name is very unique,. Because all the apps on android market are separated by the package.
see all this is in place....
taken from while uploading file to android market error
I had this issue suddenly as well,
my solution was
flutter clean
flutter build apk
and it started working again
OPTION #1: Slow down an re-read every step. (Source).
Basic Setup for Signing.
Before you begin, make sure that the Keytool utility and Jarsigner
utility are available to the SDK build tools. Both of these tools are
available in the JDK. In most cases, you can tell the SDK build tools
how to find these utilities by setting your JAVA_HOME environment
variable so it references a suitable JDK. Alternatively, you can add
the JDK version of Keytool and Jarsigner to your PATH variable.
...
Eclipse Users
If you are developing in Eclipse/ADT (and have set up Keytool and
Jarsigner as described above in Basic Setup for Signing), signing in
debug mode is enabled by default. When you run or debug your
application, ADT signs the .apk file with the debug certificate, runs
zipalign on the package, then installs it on the selected emulator or
connected device. No specific action on your part is needed, provided
ADT has access to Keytool.
OPTION #2: Test the features required by your application with an unsigned '.apk'. (Source).
You can use the aapt tool, included in the Android SDK, to determine
how Google Play will filter your application, based on its declared
features and permissions. To do so, run aapt with the dump badging
command. This causes aapt to parse your application's manifest and
apply the same rules as used by Google Play to determine the features
that your application requires.
To use the tool, follow these steps:
First, build and export your application as an unsigned .apk. If you
are developing in Eclipse with ADT, right-click the project and select
Android Tools > Export Unsigned Application Package. Select a
destination filename and path and click OK. Next, locate the aapt
tool, if it is not already in your PATH. If you are using SDK Tools r8
or higher, you can find aapt in the /platform-tools/ directory.
Note: You must use the version of aapt that is provided for the latest
Platform-Tools component available. If you do not have the latest
Platform-Tools component, download it using the Android SDK Manager.
Run aapt using this syntax:
$ aapt dump badging <path_to_exported_.apk>
compile it & export the project under Linux (eclipse)
switch to InteliJ Studio (recommended)
It seems that from time to time there is a problem with eclipse under Windows 7,8.
flutter clean && flutter run
also works
I'm using VScode.
What happened:
After dart update, there was a permission error on flutter.bat
Solution:
Locate flutter.bat and give Full controll.
Open a cmd with Admin privileges, locate the folder that you are doing the development.
use 'FLutter clean' command (do not use vscode Terminal)
rerun app using 'Run without debug'
run flutter clean then flutter pub get. Then run your application, it should work
Error while run xamarin.uitest on using android sdk build tools 29.
Problem solved by changing android sdk build tools to 28.
I have same problem and solved by deleting all folders containing apk files in the location -
D:\FLUTTER\MY PROJECTS\SAMPLE\myapp\build\app\outputs.
if any folder is found access denied then force delete the folder or restart your system and try deleting the folder, then rebuild the app. It will work.
Go to the directory build/app/outputs/apk/debug , and the directory build/app/outputs/apk/flutter-apk . Erase the present files, once the compilation has run these files will rebuild and the error will disappear!