When creating a plugin project in Flutter, an example app, that is using the plugin, is added in a subfolder of the plugin project. What needs to be done to add a second "example" app to the plugin folder?
So far I have:
Copied and renamed the example folder to (let's call it) app2.
Adjusted the package names at the android manifest files of app2.
Renamed pluginrootfolder/app2/pluginname_example.iml to pluginrootfolder/app2/pluginname_app2.iml (to reflect the name of the second app).
In the .iml file of the plugin project (the root folder):
Copied and adjusted the exclude folder directive to reflect app2
<excludeFolder url="file://$MODULE_DIR$/app2/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/app2/.pub" />
<excludeFolder url="file://$MODULE_DIR$/app2/build" />
Run Flutter clean and Flutter pub get in both the plugins root directory and app2's directory.
Problem now is that app2 causes 1k+ Target of URI doesn't exist: error messages - from packages (like provider and json_annotation) to classes in the plugin's root project.
Do you have any ideas what's wrong here or how to fix it?
Firstly, please give a full GitHub reproducible repository and link it here so I can examine. And also paste (e.g. using github gist) the long log. Please comment to this answer so I can examine more.
"In the .iml file of the plugin project (the root folder)" - indeed not that needed. iml is for intellij idea, and is unrelated to flutter. so should not error even with wrong iml. You can even safely delete iml and when you import that module in intellij it will auto recreate.
Have you modified pubspec.yaml? e.g. the package name in it.
And, where is your plugin located, relative to your app2? In example app, the default pubspec.yaml uses path: ../ to point to your plugin. So if your app2 does not have .. as the plugin path you should change this as well.
Anyway, paste your log and give a reproducible sample please...
I suspect your issue is in the dependency tree. Your example2 project does not seem to point to the project above it. The only manual edits you need are in the pubspec.yaml. In the dependencies for the second example project.yaml file, include the path to the root project. For example:
dependencies:
<YOUR_ROOT_PROJECT>:
path: ../
flutter:
sdk: flutter
Including that should map the decencies of the root over with pub.get.
That should take care of the Target of URI doesn't exist errors.
Since you are using .iml files, I assume you're using an IntelliJ/JetBrains IDE. Creating example subprojects can be done without all of the manual work you listed.
You don't have to copy the files themselves manually to create a second example. You can simply right-click on the project root and select new module. Choose Flutter. The project type is Application.
Secondly, you don't have to add the second project to the exclude folders.
Related
I am write a flutter public lib, before I commit the code to the repo, I want to compile the whole project. Sometimes I want to make sure all code could compile, for example, after you changed the function the IDE may not give obviously tips somewhere going wrong, is it possible to compile the project? when I am developing a app I could run it, but when I develop a public library I do not know how to run it and check the whole project.
When making a public package, you should include an example project within it. It's basically a new flutter project that sits inside the pub project, typically under "example" folder. You can take a look at one of my packages here on GitHub, to get an idea of the folder structure.
If you click into example folder, you will see a complete Flutter project on its own. It has its own pubspec.yaml as well, and refers to the "parent folder" to use the pub package as a demo.
dependencies:
flutter:
sdk: flutter
animated_flip_counter:
path: ../
Check the docs about writing packages. https://docs.flutter.dev/development/packages-and-plugins/developing-packages
I am using Ionic framework to start on a Cordova hybrid mobile application.
Installing Ionoic via NPM was successful and had no issues.
I am running the below command in a directory as shown below.
C:\wamp\www\my_cordova\> ionic start myapp
This creates a new folder called myapp inside my_cordova folder, which is fine.
But it also creates the plugins folder in C:\wamp\www\ folder. This is the case always how much deeper I create the folder structure. Even if I start a project in C:\wamp\www\my_cordova\level1\, still the plugins folder is created in C:\wamp\www\ folder.
The same happens for platforms folder too when I add them. They are created in C:\wamp\www\ folder.
Is this expected or is it something wrong from my side? I expect all the folders(plugins and platforms) to be created within the same folder directory where I start the ionic project.
It's a problem with the CLI. As the path has "www" in it, these issues happened.
When I tried the CLI commands in another path which does now have www in it, all went fine.
Trying to create custom UI component going through ZK 6.0.1 Component Development Essentials.
Always got error in logs "http://localhost:8080/zk6/zkau/web/_zv2011051111/js/examples.com.foo.wpd : HTTP Status 404 - /js/examples.com.foo.wpd" when trying to use custom component.
Found the war file with this example in scala, it works OK. I have copied all files from it to my project, and got same error.
The project structure is according to tutorial. What might be wrong?
You have to put the web folder, which contains the js files, in the java classpath, that means it should be put under the src folder. More easy way is to use the ZK Maven Archetype to create the template for you.
At least the way IntelliJ IDEA does things (which I see your are using, as am I), simply placing the web folder under the src folder doesn't seem to automatically get it copied to the artifact (although I'm not sure why). So I tried manually putting it in the WEB-INF/classes folder, and that worked. So the correct path for your example is <project-root>/web/WEB-INF/classes/web/js/examples/com/foo/zk.wpd.
My environment:
Netbean 6.9.1
Glassfish 3.0.1
Windows 7
Goal:
When my coworkers opens the Netbean Project, the library is already referenced without them manually create library, adding jars into it and reference it.
Detail:
I created Netbean project and the project has reference to few jar files in the folder.
Currently whoever opens the project for the first time, they have to manually create library and refer it to the project.
My project location:
C:\Users\masatosan\Desktop\myProject\myApp
My library location:
C:\Users\masatosan\Desktop\myProject\lib\myLib
The myLib folder contains:
some1.jar
some2.jar
some3.jar
I can achieve my goal if I create reference to individual jar file by defining to project.properties file like below: (creating reference to sqljdbc4.jar)
file.reference.sqljdbc4.jar=../lib/sqljdbc4.jar
javac.classpath=\
${libs.restlib_gfv3ee6.classpath}:\
${file.reference.sqljdbc4.jar}:
But my case is different since I have 3 jars in the myLib folder and wanting to reference them all.
Is it possible to reference all jars in myLib folder?
Please let me know if you need more clarification.
I'm sorry, but it doesn't work that way. When you create a project, you have to add the jar files individually.
However, if you put your lib folder under your project, netbeans will refer to them via relative paths. Then when you share the project (lib directory included), netbeans will be able to automatically find the jar files when the next person uses the project. That way you only have to add jar files once.
Short of using a dependency management tool like maven (which Netbeans has good support for), this is really the best solution. It uses a bit more disk space (obviously), but that's never been a huge issue for me.
I figured how so let me share.
Tool --> Library then library window pop up.
Create library called "MyLib" which contains multiple jars.
Add "MyLib" to your project. This change will be written to project.properties file under nbproject folder.
project.properties file indicates the classpath of lib reference you just added.
It should look like something below
javac.classpath=\
${libs.Excella.classpath}:\
${libs.MyLib.classpath}
Now someone else opens the project from different machine and she just needs to do step#1 and #2, which is to create library with same library name i.e. "MyLib"
I think this is what Bill was saying originally but thought it would be helpful to give step by step instructions since I finally figured .... after long time :D
I am compiling an app which is a sample app that uses an api. The api contains interface files (java files) and aidl files. Now I have problem in one of the interface file it cannot recognize the one of these aidl files exists in my project.
I have linked the whole api to the build path.
Does anyone has any idea ??
I had the same error, but it was fixed when I cleaned and rebuilded the project.
Projects -> clean project so it can automatically rebuild.
Look closely at your manifest file, check that the package etc are
spelled as you'd expect.
Also dont forget to paste the server's *.aidl and parcelable implementation (java) to your client project. These files has to have the same name and package as they were in the server project.
Here is some similar posts which might help:
ITelephony.aidl not compiling in eclipse
There are basically two possibilities.
(most likely) you need to make the folder that contains aidl files source folder. if you haven't done so, please do it.
You need a clean build.