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.
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 = '';
I have a project that builds several similar apps, different apps require different resources. I have folder assets/images_project1 and images/project2. How can I exclude e.g. images/project2 from the compilation? I don't want to manually replace the folders every time. If files still, they increase the app size
According to this there is no built-in solution as of right now.
But the easiest thing to do is just manually comment folder in pubspec.yaml under the assets section.
Optionally you can use script from the mentioned question.
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.
So I have a library project where I defined a couple of functionblocks and interfaces.
Now I want to use this library in a plc project (in the same twincat solution). So I do the whole save all, rebuild, save and install as a library spiel. If I try to declare a VAR in my MAIN it will result in unknown type errors. I have fiddled around a bit, and when I declare an interface withouth any properties or methods (in the lib) then I it does show up and can be used in the MAIN. But as soon as I add a property or method the class/FB/POU dissapears in the eyes of my MAIN...
I feel like I'm overlooking some option / atribute to help the PLC project to use the lib properly...
What am I missing here?
EDIT:
as you can see in the images, empty blocks are found, adding anything magically makes it dissapear
error
available classes
EDIT 2:
I solved my problem by copying the lib to a new solution. Something in the original project made it be broken. Why it did that is still a mystery...
Try following steps:
clean the solution where you programmed the library.
right click on the project and click check all objects
if this is successfull, install the library again, remove it from the reference section and re-add it.
Then clean again and build all.
In my Ember-cli project, I put some static assets, such as images and icons into the /dist/static/image directory. Then I build the project (I forgot the details in this part).
Then when I tried to modified some picture inside that folder (I wanted to change some parts to be transparent), I found that I cannot change anything inside.
For example, when I used a new pic to replace the old one, and then I run ember, I found that the new pic was replaced by the old one automatically.
I am not so sure about the internal mechanism, and I tried to use git, but that didn’t help.
/dist is just that - it gets wiped out on each build and reloaded with the distributable files. What you are looking for is /public