com.badlogic.gdx.utils.viewport Doesn't Exist - import

Trying to import a viewport, more specifically a ScreenViewport, into a libgdx project project but the package doesn't seem to exist on my machine. According to the documentation and code other people have posted I'm using the right address but I'm getting an error.
import com.badlogic.gdx.utils.viewport.ScreenViewport;
"The import com.badlogic.gdx.util.viewport cannot be resolved."
Any idea what might be happening?

The most probable possibility is that you are using an old version of libgdx.
Try updating jar files in your project (manually or using ui).
Hope this helps.
Good luck.

Related

Polybrush errors in unity 2019.4

i tried to import Polybrush in my unity project on editor 2019.4, and it seems causing many errors, is there a way to correct the errors and use Polybrush again ?
Thanks in advance.
Problem solved ! Unity seems owning Polybrush now, when i tried to import Polybrush as a custom package, somehow i had two versions of polybrush in my project, once through the package manager, and one imported directly into the project, i deleted the one imported as a custom package and i imported the verified version from the package manager, That solved the problem.

Scala import not working - object <name> is not a member of package, sbt preppends current package namespace in imports

I have an issue when trying to import in scala. The object Database exists under com.me.project.database but when I try to import it:
import com.me.project.database.Database
I get the error:
object Database is not a member of package com.me.project.controllers.com.me.project.database
Any ideas what the problem is?
Edit:
It is worth mentioning that the import is in the file Application.scala under the package com.me.project.controllers, I can't figure out why it would append the import to the current package though, weird...
Edit 2:
So using:
import _root_.com.me.project.database.Database
Does work as mentioned below. But should it work without the _root_? The comments so far seem to indicate that it should.
Answer:
So it turns out that I just needed to clean the project for the import to work properly, using both:
import _root_.com.me.project.database.Database
import com.me.project.database.Database
are valid solutions. Eclipse had just gotten confused.
imports can be relative. Is that the only import you have? be careful with other imports like
import com.me
ultimately, this should fix it, then you can try to find more about it:
import _root_.com.me.project.database.Database
In my case I also needed to check that object which is not found as a member of package is compiled successfully.
I realize this question already has an accepted answer, but since I experienced the same problem but with a different cause I figured I'd add an answer.
I had a bunch of interdependent projects which suddenly needed a root import in order to compile. It turned out that I had duplicated the package declaration in a single file. This caused some kind of chain reaction and made it very hard to find the source of the problem.
In summary I had
package foo.bar
package foo.bar
on the top of the file instead of just
package foo.bar
Hope this saves someone some really tedious error hunting.
In my case I had to run sbt clean.
I had faced similar issue where IntelliJ showed error on importing one file from the same project.
What did not resolve the issue in my case:
adding _root_ in import statement
sbt clean
restarting machine
What actually resolved the issue:
main menu => select File => click on Invalidate Caches / Restart => pop-up dailog => click on invalidate the caches and restart.
I was using IDEA (2019.2.2 Ultimate Edition) on macOs mojave 10.14.6
Java -> Scala conversion without cleaning
Don't forget to clean if you convert some file in a project from Java to Scala. I had a continuous integration build running where I couldn't get things to work, even though the build was working locally, after I had converted a Java class into a Scala object. Solution: add 'clean' to the build procedure on the CI server. The name of the generated .class file in Scala is slightly different than for a Java class, I believe, so this is very likely what was causing the issue.
If you are using gradle as your build tool, then ensure that jar task is not disabled.
I had multiple modules in my project, where one module was dependent on a few other modules. However, I had disabled jar task in build.gradle:
jar {
enabled = false
}
That caused it to fail to resolve classes in the dependent modules and fail with the above error.
I will share my story, just in case it may help someone.
Scenario: intellij compilation succeeds, but gradle build fails on import com.foo.Bar, where Bar is a scala class.
TLDR reason: Bar was located under src/main/java/... as opposed to src/main/scala/...
Actual reason: Bar was not being compiled by compileScala gradle task (from gradle scala plugin) because it looks for scala sources only under src/<sourceSet>/scala.
From docs.gradle.org:
All the Scala source directories can contain Scala and Java code. The
Java source directories may only contain Java source code.
Hope this helps
I had a similar problem but none of the solutions here worked for me. What did work however was a simple restart of my machine.
Perhaps it was something with my Intellij but after a quick restart, everything seems to be working fine.
I had a similar situation, which was failing in both IntelliJ and maven on the command line. I went to apply the suggested temp fix (adding _root_) but intellij was glitching so bad that wasn't even possible.
Eventually I noticed that I had mis-created a package so that it repeated the whole path of the package. That meant that the directory my class was in had a subfolder called "com", and the start of my file looked like:
package com.mycompany.mydept.myproject.myfunctionality.sub1
import com.holdenkarau.spark.testing.DataFrameSuiteBase
where I had another package called
com.mycompany.mydept.myproject.myfunctionality.sub1.com.mycompany.mydept.myproject.myfunctionality.sub2
And the compiler was looking for "holdenkarau" under com.mycompany.mydept.myproject.myfunctionality.com and failing.
I had this issue while using Intellij and the built-in sbt shell (precisely, I was trying to run the command console, which invokes a compiler check of the code).
In my case, after trying the other suggested solutions on this thread, I found that I could restart the sbt shell and it would go away. There's a button on the left-hand side of a looped green arrow and a small grey square which does this in one click (obviously, this is subject to Jet Brains not changing the design of the IDE!!!).
I hope this helps some people get past this issue quickly.
In my case, In Intellij, Just renaming the package file to something else >> see if it updates the import statements >> run the code >> then renaming back to the original name worked.

Weka class cannot be initialized: InvocationTargetException

This is my first time using weka, I am sorry if my question seems naive. But I was really stuck by this problem.
I am using weka in my own java project in eclipse. I have successfully import weka.jar with attached wekasource.jar. But when I ran the program, all the weka class always failed to be initialized(attribute, Fastvector etc.). All the exceptions are the same:
InvocationTargetException
I check the error stack where showed: java.lang.NoClassDefFoundError: weka/core/attribute
Additional Info: I tried to create a new project in eclipse ,and use weka, it works. But it still can not work in my own existing project.
Does anyone have some ideas how should I solve this problem?
It seems I have solved this weird problem. The solution is simple:
right click on the project, in the java build path, check weka.jar in order and export tab.
Hope it can help the later people who face the similar problem

PyDev: not seeing module within project

PyDev 2.5 and Django 1.4
I'm very new to this, and am probably making some stupid mistake, but I've looked around and can't figure out what I'm doing wrong...
After creating a new app within my project and then adding it to INSTALLED_APPS in the project settings file, I attempt to run the server (RunAs --> PyDev: Django) and get:
Error: No module named < appname >
Originally I thought this was being caused by the error reported here (error creating settings.py): http://sourceforge.net/tracker/?func=detail&aid=3512322&group_id=85796&atid=577329
But updating to the nightly build solved that. (Note: The project's Django module settings field remains blank initially, but it seems to find it when I type it in manually).
Yet it still can't find the app/module. Maybe I am just missing something obvious here, but I'm really not seeing it.
Please let me know if you need more information.
Thanks,
Ryan
This is probably an issue in the way you're writing your code and the PYTHONPATH that's configured...
For a better answer, please give more details on those (a screenshot from the pydev package explorer with your project structure and the INSTALLED_APPS setting should suffice).

I can't get qml to use my custom plugin

I'm working in QtQuick and right now struggling with a weird problem: I can't get my custom plugin to work in Qml. There's a simple demo in the SDK (Examples/4.7/declarative/tutorials/extending/chapter6-plugins) and this doesn't work on my computer either. I don't get any error messages except that it doesn't recognize my custom items. Has anybody seen this problem? Any suggestions?
My setup:
Win 7 Home Premium, Qt Creator 2.1.0, Qt 4.7.3 (MinGW 4.4)
Thanks
Beside the qmldir issue already mentioned by blakharaz, also make sure to set QML_IMPORT_PATH in your pro file or setting the path via QDeclarativeEngine::addImportPath() so the module can be found on your development environment (if you don't install them systemwide before using).
And when using subfolders, make sure they are part of the import (see http://doc.qt.nokia.com/4.7-snapshot/qdeclarativemodules.html)
It would be nice to have some code. One possible issue could be the directory structure or the qmldir file. If you want to have a plugin called Foo you basically need a directory Foo which contains the Foo.dll (or libFoo.so) and a qmldir file (content is at least "plugin Foo")
If you have that "import Foo 1.0" should load the library.
I just had the exact same problem.
Build your .dlls as release instead of debug, that fixed it for me.