When I run flutter build apk --release everything works just fine, In addition when I connect my phone to the computer and run flutter install -v everything is ok. Also when I run flutter run -v my app is working on my phone just fine.
BUT when I'm sending the apk manually to my phone, install and open my app, it's stuck on the splash screen.
I don't know what can case it not to work manually (since I cannot track my logs).
I'm using firebase, my google-services.json is up to date.
flutter doctor is just fine.
android SDK version 30.0.2.
app/build.gradle compileSdkVersion 30.
gradle version 6.6.1.
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.android.tools.build:gradle:4.0.2'
Any suggestions how to validate my application? What can case such a problem?
Thanks you!!!
More Information
The only error on flutter run is:
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.name.name signatures do not match previously installed version; ignoring!]
but as I said before the flutter run do works and my app uploads correctly, so I think it is not related to my problem.
Have You implemented release SHA keys ?
After many tests using flutter run -v I encountered that in some cases I'm getting:
Unhandled exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
I do work with shared_preferences package and that answer sure solve my problem https://stackoverflow.com/a/63027655/12695188
Although this is a specific solution I will describe what I have done in order to find my problem:
flutter pub get
flutter build apk --debug
flutter build apk --profile
flutter build apk --release
connect your physical device to your computer
flutter install -v (to your physical device)
flutter run -v
Solve each problem you find on flutter run -v.
Hope this will help someone out there.
Related
Since the system update of my Vivo y20i device, I am having trouble installing my flutter app. When I run (Ctrl+F5) my app it get stuck in Running Gradle task 'assembleDebug'... sometimes it is stuck in Installing build/app/outputs/apk/app.apk. My developer option is turned on and also the USB Debugging, I tried every solutions that I found here in stackoverflow and other websites:
I run the ./gradlew clean and ./gradlew build and also tried ./gradlew clean build
Uninstall the app in my device then flutter clean. I always do the flutter clean
I uninstall everything, Android Studio and VSCode, and I upgrade my Flutter SDK to 2.5.0, and also did this.
but I am still facing the same problem. When I try flutter run -v, it works but then I can't update my app or do any changes in the app. Please help.
Here is my flutter doctor -v
Sometimes the problem can be with ADB Server.
Run this:
adb kill-server
Connect your device again and it should work.
Also
Settings>>Accounts and sync>>Delete Work Profile or any User Profile created on your phone.
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
I am on android studio 4. Gradle is 6.1.1. And I created a new flutter project from android studio. Then I opened the project as an android project. There is such an option in Tools->Flutter. Which resulted in gradle sync. That was successful. But when I try to generate signed apk with my keys. I get this. error
\path\to\my\project\build\app\intermediates\flutter\profile\libs.jar (The system cannot find the path specified)
There is no profile directory at the given location. But there are Debug and Release directories both of which contains libs.jar. I searched all other the net for this issue. Found Nothing.
Additional: I can build debug apk with no issues.
I found a fix for this issue as I was searching through various issues people had reported on github regarding this.
This is just a workaround.
You can get two kinds of error. For me the system could not find profile/libs.jar, for some people the error was for debug/libs.jar. If the issue is profile, you should first run your app in profile mode and then Generate signed apk (or build and run in release mode). To run in profile mode use flutter run --profile. There is also a profile option under Run menu in Android Studio.
If the error is about debug/libs.jar, first build the debug version (and also the profile mode) and then try to Generate signed apk. By default, flutter run compiles to debug mode.
This issue evidently arises from the updated Gradle and android studio gradle plugin.
Here is the workaround by Jwiggiff on the github page.
This problem is with latest gradle 4.0.0
Switch from classpath 'com.android.tools.build:gradle:4.0.0'
to classpath 'com.android.tools.build:gradle:3.6.3'
or classpath 'com.android.tools.build:gradle:3.5.0' (Worked for me)
If you don't care about lintOptions you can add this code in app's build.gradle file:
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
This should also work fine
flutter build apk --profile
this will work.
flutter build apk --debug &&
flutter build apk --profile &&
flutter build apk --release
but test the apk before sharing it.
even it doesn't work the change the gradle from 4.x to 3.6.x this will work.
This is a trick
Run terminal for current flutter project, then type
flutter run
to get this success result :
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 22.7s
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
then, type
flutter build apk
to get
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 41.8s
✓ Built build/app/outputs/flutter-apk/app-release.apk (23.6MB).
then, install this Release APK to device.
flutter install build/app/outputs/flutter-apk/app-release.apk
Now, you got Release App on your device.
p/s : This case skip error
Execution failed for task ':app:lintVitalRelease'.
Failed to transform libs.jar to match attributes
Execution failed for JetifyTransform
Transform's input file does not exist
you already got.
In my case, I forgot that I'm using flavors. Maybe this caused the issue.
Now I let flutter build the app with the following command:
flutter build apk --flavor <flavorname> -t <path/to/main.dart>
Permanent fix
To fix this issue permanently, type in terminal
flutter doctor
This will give you summary like this
You need to fix all those red marks!!
Fixing android licenses
type flutter doctor --android-licenses
if you encounter this error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Try to install Android SDK command-line tools from Android Studio (Tools > SDK Manager)
Unfold Appearance & Behavior
Unfold System Settings
Click Android SDK
Click tab of SDK Tools
Check Android SDK Command-line Tools (latest)
Click Apply button
Then run once again
flutter doctor --android-licenses
Fixing Flutter plugin not installed
Check your Android Studio Version (For Mac go to ~/Library/Application Support/Google/AndroidStudio{Version}. In my case, the {Version} is 2020.3)
Then type
ln -s ~/Library/Application\ Support/Google/AndroidStudio2020.3/plugins ~/Library/Application\ Support/AndroidStudio2020.3
This command just redirects flutter doctor to the different folder to find plugins (where they are now). This is called symbolic link
Fixing unable to find bundled Java version
This solution is for Mac User
Find your local Java version by typing /usr/libexec/java_home -V
Set Java_Home path by typing /usr/libexec/java_home /Library/Java/JavaVirtualMachines/jdk-17.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
Happy Ending
After fixing all those issues, run
flutter clean
flutter run
to build release apk
flutter build apk --split-per-abi
I just developing Application on Flutter framework.
Now, I just faced some problem, I think that it depends on the Gradle crash.
it doesn't work......till now
So, I attached the error message's image file.
this message came from the command(flutter run -v)
the result of 'flutter doctor --verbose
So, How can I build this thing???
run flutter doctor -v and do all the requisite steps.
I am trying to get the tutorial project startup_namer running. I am getting following error after I added english_words dependency on pubspec.yaml
Resolving dependencies...
The Flutter SDK is not available.
Flutter users should run `flutter packages get` instead of `pub get`.
Any idea on how to resolve this? I followed Google getting started documentation but didn't work out for me :(
Run this command in terminal/Command Prompt
flutter doctor
It automatically installs the missing dependencies or download the flutter sdk if necessary
if already install still problem exists run
flutter upgrade
You can check this link to get the Flutter SDK installed on your machine. If you already have the SDK and want to install the dependencies in pubspec.yaml, run this command in the project's root folder:
flutter packages get
If you get this error message in Android Studio then you probably don't have the Flutter plugin installed.
I just could reproduce that and for example opening the pubspec.yaml asked me to install the plugin and then the error was fixed.
You can also install it manually using the preferences.