Flutter apps won't run after switching from WIN 10 to Ubuntu - android

App originally created in Win 10. I switched to Ubuntu.
When I try to run an app I get the following error.
Any ideas where do I need to edit the path (prev. C:\)?
Thanks, Ron
* What went wrong:
Could not determine the dependencies of task ':app:flutterBuildDebug'.
> java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\\Dev\\FlutterApps\\xxxxxxxxx\\lib\\main.dart

Actually, flutter saves the path of your packages in a file. So, the error you are getting is because the path from Windows file system are saved in your project and those path are not valid on Ubuntu. To solve this:
open terminal in your project directory and use flutter clean.
then flutter packages get
now try to run your app.

Nevermind. I just ran flutter clean which removed the build folder. Then ran flutter run and it rebuilt the build folder and loads now.

Related

Why is my settings file missing if I copied and pasted my entire project folder?

I copied/pasted my project folder from my desktop to my laptop and installed most of the things needed, like the Android SDK, flutter, and the dart sdk. However, when I try to run my app, it gives an error:
Starting Gradle Daemon...
Gradle Daemon started in 2 s 402 ms
FAILURE: Build failed with an exception.
* What went wrong:
Executing Gradle tasks as part of a build without a settings file is not supported. Make sure that you are executing Gradle from a directory within your Gradle project. Your project should have a 'settings.gradle(.kts)' file in the root directory.
Why would this file be missing if I copied the whole project root folder?
In terminal run
flutter run
In the root directory of the project..
Or if you are using VS Code try
f5 key to start debugging. Or in case of android srudio you should be seeing a play button to run it as a flutter project.
The problem was that I was hitting the play button while the configuration was set to something other than main.dart.

Gradle does not have execution permission

I am having this problem when I try to compile my first app in flutter. I have already read several solution proposals but they are for mac or linux, when I try to use the command: chmod a + rx android / gradlew it tells me it does not exist. I am using windows. I attach photos of the error error flutter doctor
From the screenshot given the problem seems to be with where your project is located. Try moving your project into an accessible folder/ directory outside of the the C:/ or the current directory into something like C:/users/your_username/fluter_development/. This will make sure that gradle has the right permissions to download the necessary artifacts to build your app successfully.

Flutter : Several variant outputs are configured to use the same file name

I am just trying to run the first app and this is what happens:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageDebug'.
> Several variant outputs are configured to use the same file name "resources-debug.ap_", filters : MAIN:MAIN
Please try flutter clean and rebuild.
I got the same error while trying to integrate FCM into my application.. The problem is in the older build file.. i.e as we are editing our Manifest file we need to rebuild the project so..
flutter clean
flutter run
Make sure to do gradle sync if the problem persist..
It solved the problem for me..
Close and reopen IDE
flutter clean
flutter run
just log out from current windows session and then do flutter clean and after run your project. that will solve the problem.
If flutter clean doesn't work, then delete the Android folder, then run flutter clean and run the app... Make sure you have an android emulator or device connected as your run device, this will bring a prompt asking you to enable android for your project then just click yes.
You can also uninstall the app from your emulator or android device before you run it again, but make sure its uninstalled on all profiles of your device.
this error also appear when you mistakly disable the app and try to debug same app again.So go to applications and enable it again to resolve the issue.Thanks
remove pubspec.lock
flutter clean
flutter run

cannot run ADB: the operation requires elevation

I recently started learning React-Native and was trying to run a project on Android emulator.However, this was succeeded at the first attempt, but now It doesn't, throwing the following error.
Execution failed for task ':app:installDebug'.
java.io.IOException: Cannot run program "C:\Users\Pavindu\AppData\Local\Android\Sdk\platform-tools\adb.exe":
CreateProcess error=740, The requested operation requires elevation
Since this is a well known error message,I could find lot of answers regarding this error.The following were the actions I took according to those answers.But none of those helped me.
Running both android studio and cmd as administrator
Running cmd /c react-native run-android
Deleting node_modules and npm install
It appears to be an Android emulator problem.
Change the AVD setting to use "Use Host GPU."
That'll solve the problem.
Select 'Hardware GLES 2.0' to enable host GPU
After struggling a lot, here is what I did to overcome the problem.
Copied /Sdk folder and pasted it in a different location while keeping the old SDK folder there.
Deleted platform-tools folder in copied SDK folder
downloaded platform-tools from android site and added it to new SDK folder.
set new SDK location to ANDROID_HOME (I use windows)
and android/build.properties file in my react-native project.
sdk.dir="C:\\path\\to\\new\\sdk"
When I run react-native run-android after these steps,all started working fine.
Note: I know that this seems hacky, but as a help for someone, I decided to write this .

Execution failed for task ':app:packageDebug' - Failed to read zip file

Without any changes in my code, suddenly i get this error when I try to run my app:
What went wrong:
Execution failed for task ':app:packageDebug'.
com.android.builder.packaging.PackagerException: java.io.IOException: Failed to read zip file 'C:\Users\Eliran\AndroidStudioProjects\Forum\app\build\outputs\apk\app-debug.apk'.
I have no idea why its trying to read the apk as zip file.
If I restart Android Studio, I can run the app once and then It happens again.
For me it helps (for now) when I Exit Android Studio, next I used Windows Task Manager (Ctrl + Shift + Esc) and kill process Java(TM) Platform SE binary and delete that file manually. After that I run Android Studio again, click on the Clean Project (there can be an error with app:clean, but you can run Android Studio again) and next click Make Project - after that of course Run 'app' button in Android Studio.
This issue has been reported to the development team: https://code.google.com/p/android/issues/detail?id=210693&thanks=210693&ts=1463824240
Its solve my problem perfectly. i Just delete my build file and file>> Invalidate and restart android studio. This problem occur for me change dependency version
I try manual delete file, but the SO inform: the file "app-debug.apk" is in use by "OpenJDK Platform Binary". Then I kill "OpenJDK Platform Binary" and this worked.
If you are using flutter, type
flutter clean
and restart your ide. It worked for me.
After wasting my 4 hours i could fix this.
I fixed it by deleting ~/.android/debug.keystore file.
1.delete debug.keystore file
C:\Users\xxx\.android\debug.keystore
flutter clean
restart ide
just delete debug.keystore file under .android

Categories

Resources