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.
Related
I have got my expo project and I ran 'expo eject' to run it in the react-native CLI. It works on the iOS with some adjusting (thanks to the guys on GitHub) however I can't seem to get my android to work. It's saying
'Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.'
I have tried building a new react-native app (without using expo) and it works no problem.
To me the ejected project is not linking to the environment somewhere. I have tried updating android studio, going through the environment setup and update gradle (that caused more issues haha)
Has anybody else come across this please?
I have worked out the solution around this. Run these next steps soon after you do 'expo eject' (As it suggests in the console after eject runs)
Next steps
› 💡 You may want to run npx #react-native-community/cli doctor to help install any tools that your app may need to run your native projects.
› 🔑 Download your Android keystore (if you're not sure if you need to, just run the command and see): expo fetch:android:keystoreNext steps
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.
I installed flutter and android studio following the steps in the flutter official page. I did it a month ago and then I used flutter doctor and I did not get any problems back then.
Now I tried again but I keep getting those errors
I have Android Studio installed (version 4.1)
If you are not installing android studio into the recommended location. Then you need to link it back for Flutter doctor to find it.
I install android studio to my home dir "/home/{$USER}/android-studio"
The quick and dirty way is cd into your "/opt" folder then symlink it
$ cd /opt
$ sudo ln -s /home/me/android-studio android-studio
Then run flutter doctor (or with a -v to see more detail) you should able to see it finds it.
First of all, run the command as said flutter doctor --android-licenses.
It will show you the licenses and you just have to type Y in the command line to accept them.
Secondly,it seems can't find Android Studio. If you have that, I suggest you to uninstall and re-install it clearly. Of course you should also install the Flutter plugin in Android Studio.
When everything is done just use flutter doctor. The last warning "Connected device" is going to be visible until you don't use an emulator or connect via USB debugging your phone.
With regards to Flutter not being able to find Android Studio: I had the same issue since upgrading to Android Studio 4.1 a couple of days ago. Since I use VS Code it didn't bother me too much. However yesterday I received an update notification from Flutter and after the update the problem went away.
In a new flutter project, I run flutter doctor command and it says everything is okay. When I try to run my app it doesn't finish or error out. It just says running. What should I do.
if everything is right with flutter doctor command, your app is probably initializing gradle which took some time before the app is properly running.
Run flutter run -v and you will see output telling you that the app is initializing gradle
This is how it looks in the Run window:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
give it sometime to download gradle and it will run normally, of course this won't be an issue for future runs but always run flutter with the -v option
Installing Flutter with Android Studio does not show me the device list that I am expecting. When inspecting the same using the flutter devices it shows me results but not in the Android studio device list. Can anyone please tell me the solution. Adding some screenshot regarding the same.
Also here is the screenshot of the flutter doctor
Any help is welcome.
Restarting the computer should fix that.
If you want to avoid restarting, you can also use
adb --kill-server
killall -9 dart
to killing all dart processes (they will be re-started on demand anyway)
Configure flutter in terminal to detect Android SDK and Android Studio:
$ flutter config --android-sdk /path/to/android/sdk
$ flutter config --android-studio-dir /path/to/android/studio
Then restart Android Studio/Intellij.
source: https://github.com/flutter/flutter-intellij/issues/2113#issuecomment-383412308
Original answer: https://stackoverflow.com/a/50019226/3879756