I'm not really sure what I did, but it seems like I ended up making the path of flutter split into two different places, and the flutter SDK Checkout is not in the right one. I've been trying for hours to fix it. This is what flutter doctor shows. My Flutter Doctor. Also, here is my .zshrc file..zshrc
So far, I've tried editing the path using export PATH="$PATH:pwd/flutter/bin"
I've also edited the .zschrc file to change the path there, and I've once tried PATH="$PATH:/Users/artemis1/applications/flutter/bin, but so far, the same warning still shows up.
If you want to update $PATH according to the warning message, you will have to put the desired path in front of the existing $PATH.
That is
export PATH="/Users/artemis1/applications/flutter/bin:$PATH"
The paths inside $PATH are used in the order they are listed.
Aside from that you will probably want to maintain only one installation of flutter and delete the other.
Related
So I'm building a Flame Game, and I found this template (the actual code that comes with the template is here) made by Very Good Ventures (it's the one used in the Pinball project made for Google I/O).
I'm just writing my code, and added my assets in the assets/ folder, so far I only need images so I deleted all the other assets that came with the template and the unnecessary folders. Thing is, I don't know how to re-generate the gen/assets.gen.dart file to reflect the changes I've made to the assets/ directory. I've tried running my app but I obviously get an error because the assets I'm trying to load are not defined.
I tried to look up what command is needed to regenerate the assets file, and most solutions I found included this line of code which requires the build_runner, flutter_gen and flutter_gen_runner dependencies.
Now, I don't mind adding new libraries if necessary, but if they are needed, shouldn't those be in the pubspec.yaml of the template to begin with? I even checked the Pinball project repo to see if they had to add those dependencies and their pubspec.yaml does not include any of the runners or flutter_gen.
Anyway, I still tried adding the libraries and running the command flutter packages pub run build_runner build, which manages to regenerate the assets.gen.dart file to include my images and delete unnecessary directories but I still get an error.
When I do
loadSprite(Assets.images.ramp.path);
(just like they do in the VGV template), I get a red screen error because apparently Assets.images.ramp.path gets evaluated to assets/images/assets/images/ramp.png (there's an extra assets/images/).
After checking the assets.gen.dart file it seems like the VGV template creates the class AssetGenImage extends AssetImage while the flutter packages ... command creates an AssetGenImage that doesn't extend AssetImage.
I'm pretty sure I'm missing something here, because both the VGV template and the I/O pinball project manage to regenerate the assets files without issue. I just don't really know what I'm supposed to be doing.
(just in case, I have not changed anything else in the pubspec.yaml apart from removing the lines that pointed to the other assets directories I didn't need like assets/audio/ and adding the 3 new dependencies)
so you are probably getting this error because Flame by default adds a the assets/images/ prefix path on its image loading code.
That is why on your error, you are seeing that part duplicated.
To properly use flutter gen, which generates the full path of the assets, you can simply "clear that prefix", which you can do just by doing so on your game class, you can do this as the first line of your onLoad method
images.prefix = '';
When i run flutter create I get
Im not sure why that png is a sticking point everything above it are in the same parent folders. Has anyone run into this issue?The Programming Flutter folder seems like it is being set as read only:
But when i uncheck the Read only box and click apply when i open it again its set to Read Only again. But thats the very parent folder and other files seem to copy across fine before the error above.
Anyone have any idea why its failing?
Have you recently updated your Flutter version, or are you running on an older version? As per this thread, it seems to have been fixed somewhere in 2020.
It is your operating system not allowing Flutter to write files.
You can either delete that folder and create that again or change permissions. Uncheck that 'read-only' checkbox shown in picture.
You can learn more about handling permissions here.
I want to convert all absolute paths to relative paths in flutter without doing one by one. Is there any way to do so?
There's a tool available for that from Dart v2.12:
https://dart.dev/tools/dart-fix
In short:
First run with dart fix --dry-run to see what's going to change.
If satisfied with results, run dart fix --apply to apply all the changes seen in the dry run.
Finally, I am answering my own question. I found an awesome vs code extension called dart-import.
After installing this extension. you just need to open command pallet using ctrl+shift+P and search for fix all import and Enter.
So I add flutter as library like this:
Should I delete these when I finished my plugin?
You are free (and actually there's nothing wrong about it) to add the flutter lib to your build.gradle. However keep a few things in mind:
I strongly advise you to add that folder (libs.android-arm) to your .gitignore (you don't want to upload or keep track of it).
You must remove/comment that line otherwise it won't build in other machines since that will reference a lib/path that doesn't exist.
I recently tried installing zxing in xCode 4.2 for my next app. Here is what happened.
I began following the steps, everything was going ok, the first strange thing I noticed is that libZXingWidget.a library showed up red when I added it. I started to get worried because xCode still baffles me. The rest of the steps were followed without issue until I added paths to the header search paths. I tried using an absolute path from /Users to the /cpp/core/src/ and /iphone/ZXingWidget/Classes directories I set up then a relative path and no matter what I get the following error:
clang: error: no such file or directory: '/Users/myusername/Desktop/../../cpp/core/src/zxing/common/GreyscaleLuminanceSource.cpp'
Which .cpp file is causing this seems to rotate around. Funny thing is that do not ever even specify Desktop in my header search paths. Early on I had my folders on my desktop and I was referencing them from there but since then I have deleted that project and have a completely new one. I have no idea what is causing the project to search that location and I would like to know how I can change it.
Thanks!
Try deleting then re-adding the lib. If the problem still occurs, you may want to look into the pbxproj xml file with a text editor to try to see where the wrong path come from.
I had similar problem. Try to move your "cpp" folder to "Users", if it helps then you have problems with your pathes.