I have implemented #BindingAdapters in many projects. Recently created a new project in Android Studio Dolphin. added plugin kotlin-kapt and other required dependencies. Not able to figure out what is going wrong. when i use the binding adapter inside xml as attribute. there is an compilation error.
The Problem was package line. when we generate a kotlin class file or move a file from different project the package line if not present the generated classes won't be able to import them as they don't have the path from which they can be imported. i added the package line which is the 1st line in every class or file and issue was solved. silly one but took 2 days
Related
I feel a bit ashamed but I simply don't manage to add a file to my QML project in Qt Creator.
I use Qt 6.2.3 and my build system is qmake.
First off, I created a file MyButton.qml by doing a right click on the folder named QML of a project which only contains a main.qml file.
Then, when I type MyButton in main.qml I can use the autocompletion so I see Qt Creator detects my new type.
But during executation, I got this error :
QQmlApplicationEngine failed to load component
qrc:/MyProject/main.qml:9:5: MyButton is not a type
Anyone knows how to add a file to a project ?
I carefuly followed the official documentation (https://doc.qt.io/qt-6/qtqml-documents-definetypes.html) and several tutorials but nothing works. That's crazy.
EDIT :
I did what JarMan advises but I still get the same error.
Here is an image of my project arborescence
And the content of the qml.qrc file :
<RCC>
<qresource prefix="/">
<file>MyButton.qml</file>
<file>main.qml</file>
</qresource>
</RCC>
I believe the problem you're running into is simply that your executable doesn't know where to find your .qml file because the build folder is usually not the same as the source folder. To fix this, you should create a resource file (you can name it something like qml.qrc) and list all of your QML files in there. This allows the QML file to get bundled into the executable.
An example would look like this:
<RCC>
<qresource prefix="/">
<file>MyButton.qml</file>
</qresource>
</RCC>
Then in your .pro file, add this line:
RESOURCES += qml.qrc
EDIT:
You can do the same thing in Qt Creator.
Step 1:
You might already have a resource file in your project. If so, you'll see it in the Project view on the left side of the window. If you do, you can skip to Step 2. Otherwise, go to File->New File... and select Qt Resource File. Name it qml.qrc (or whatever you like).
Step 2:
Once you've created that file, it should now show up in the Project view on the left. You can right-click on the file name and select Add Existing Files. Choose your MyButton.qml file. That should do exactly what I mentioned in my original answer, but without manually typing any code.
I got the same error with Qt 6.3.1
I found the Qt Creator doesn't generate the qml.qrc file when you select Minimum required Qt version: to Qt 6.2.
So I switched the Minimum required Qt version: to Qt 5.15 in Qt Creator Wizard, the qml.qrc file will generated and my custom component qml file would be included automatically in it.
Also, the .pro configure file has different items between these two Qt version.
Solution 1:
add qml in the pro file:
resources.files = main.qml MyButton.qml
Solution 2:
add a qrc file into project and add qml as resource file
My team members and me often face the problem in Intellij that we cannot import some classes via Alt+Enter because Intellij hasn't indexed them successfully.
Our set up
We have different Flutter projects which belong and work together.
ProjectFolder:
our_project/customer_app
our_project/provider_app
our_project/server_app
our_project/model_app
Some of these projects have dependencies to other projects which are declared in the pubspec.yaml file.
Problem
E.g. the customer_app has a dependency to the model_app.
Now we add this new class in model_app such as class MyModel.
Later in the process we want to use MyModel inside of the customer_app.
If we type something like MyModel() and try to press Alt+Enter it doesn't find the class immediately. (it works miracously only sometimes)
What we have to do then is to copy the path of MyModel and do the import manually. Which is often time consuming.
We even tried to run flutter packages get which also doesn't help to find this import of MyModel. Ideally we want that Intellij find the import automatically by indexing it without copying the path out of the other project.
This is a known issue and planned to be fixed eventually.
You can upvote https://github.com/dart-lang/sdk/issues/25820
I try to add external library to my current project, but my project can't pick up the library.
I have MyLib.java file in other directory.
/Users/cat/myfile/github/JavaLib/MyLib.java
I want to my current project (/home/project/HelloWorld/HellowWorld.java) to use my MyLib.java
I'm following the steps to add Library to Intellij(15CE)
Menu->Project Structure->Libraries
click (+) symbol->select Java -> select my path(/home/lib/)
Here is the screenshot
Now that you have added your JavaLib directory to the project you should be able to use the code inside JavaLib in your code now. Intellij should offer auto-complete when you start to type the name of a JavaLib class and automatically include the import for you in your code.
The disabled Apply button you circled isn't an issue. I get that in my view too. It just means nothing has changed that needs to be applied currently.
As the title says, I wanna be able to import a custom class of mine from any new project. So for example, if I have a class called LAView, I wanna be able to type #import "LAView.h" from any new project without actually having to copy LAView.h and LAView.m into the project itself. Is that possible? :)
Create a framework, copy the finished product into /Applications/Xcode.app/Contents/Developer/Library/Frameworks and /Library/Frameworks/
This way your framework will be visible and available in any Xcode project and you can access it like any other framework from the Xcode frameworks list.
NOTE: When you edit your framework you will have to copy the new version into both these locations again. You can automate this using BASH scripts run from the Terminal (if you do this be careful!).
In VS2008, I am adding new classes to a web project.
When I right-click on App-Code -> Add -> New Item -> Class ...
The build action for the newly created item is set to content instead of compile. This seems like it would be a problem with the template. I've found several others through google who have run into this issue, but nobody seemed to have found a more permanent solution, other than "change it from content to compile after creation."
My question: Does anyone know of a fix for this, official or otherwise?
App_Code is a special folder meant for folder based projects.
This is just a hunch, but it might be that you have a project file based project, instead of a simple folder based one.