It's hard to describe without an image:
Edit: (I can't post an image till I have more reputation).
The jar exists in External Libraries, and the package contains the class ('org.robolectric.AndroidManifest'). The import statement is grey up till the word 'robolectric', but is red on 'AndroidManifest'. When I click into the package (robolectric), it takes me to the correct package, which apparently contains the class.
This is the only Robolectric library in the application, so it isn't a case of looking at one library while using another.
It's similar to this issue, but the solution didn't work.
I've cleaned, rebuilt, reindexed.
The solution I found simply involved turning all the 'testCompile' in gradle.build into 'compile'. I don't know why this works.
Related
I'm trying to import an SPM package in Xcode11. I can fetch the library and see it in the project as Swift Package Dependencies but when trying to import, Xcode doesn't find it.
I read that the problem could be custom configurations and not the standard e.g. Debug.
Does anyone know how to solve this without renaming the configuration names?
The best advice at the moment is this post on the Swift forums where Ankit says:
This is a known issue that Apple folks are tracking internally. Currently, Swift packages default to the "Release" configuration when anything other than Debug and Release is used. In theory, adding $(BUILD_DIR)/Release to SWIFT_INCLUDE_PATHS build setting for the custom configurations should work around this issue but it can lead to some weird errors in case something unexpected gets picked from that directory.
Goal:
I want to define groovy classes in .groovy files as part of a package, but without ever needing to compile them. Then, I want to define groovy scripts in the same package, import the class definitions from the nearby .groovy files, and execute the script... all without compilation.
Problem,
This appears to be possible using GroovyClassLoader() (and several people have posted how-tos). However, the problem I have that nobody else seems to reference is that this strategy means that content assist will never be able to identify your classes and methods, and your code will be full of underlines, and receive no error checking.
You might say "Thats just a side effect of using such a dynamic feature, how would eclipse be able to know?", but consider the following:
As I was building my project, I was creating the scripts and the classes in the package just like normal a program. When I add my import statements for my custom classes, Eclipse recognizes everything and content assist is happy. However, despite content assist being satisfied, it hits a snag when I try to execute a script because eclipse returns: unable to resolve class (presumably because it's still only a groovy file, and not compiled to a class file).
So, I looked around and it looks like I have to comment out the import statement, and then use groovyclassloader to parse the groovy file instead. However, this has the negative side effect of breaking content assist.
Question: Are my conclusions above all basically correct?
Suggestion: Is there any known way to have content-assist work along-side with GroovyClassLoader? Maybe some way to tell it to ignore failed imports or something?
It turns out this was a problem with the way I had configured my classpath. Once I had my folder structure consistent with the package structure, eclipse found my class files and was able to import the classes.
I notice that there are a lot of old tutorials from about 2010 that use
com.google.zxing.client.j2se.MatrixToImageWriter
to write 2D barcodes to files.
Also, I notice a lot of old tutorials specify the use of Android.
I am using Eclipse on Linux Mint, not Android.
Eclipse will happily import the main src tree of java files and show them as available packages. For example, I can get all the packages under zxing/core/src/main/java to show up; I can import classes from those packages and compile them.
However, I can't seem to import the com.google.zxing.client.j2se package when I have the core packages imported, and vice versa.
If there is a way to write BitMatrix objects to files without using
com.google.zxing.client.j2se
that would simplify matters.
Alternatively, if there is some way to get Eclipse to import both sets of packages, that might be an alternative. I have already tried modifying the "filters" under the "properties" tab, on the theory that if I can use two filters, the first can pick up
core/src/main/java
and the second can pick up
/javase/src/main/java/
But that didn't work for me.
Suggestions are welcome. Thanks.
Ran into the same problem with the import. It appears that we both forgot to add the javase.jar into the project. Download it from here, import and you will be able to import MatrixToImageWriter.
I have created a class in Java that I need to import into NetBeans and use in a GUI. What I have done so far is add the jar file containing the classes to the library in my project. I can look inside the jar file and see the classes I need inside the . I have looked around online and know that the best to way import these classes is to move them to another package that isn't the .
My problem is that I do not know how to do this. I saw that I can create a package in netbeans, but it is gray when it appears and I can't seem to do anything with it. I basically have no idea how to create packages that I can use to import classes If someone could please walk me through step by step I would greatly appreciate it. I have looked at the other posts on this site and other places online, but they seem to skip over somethings I am not sure about. My teacher didn't mention anything about packages either, so I am really in the dark.
You can copy your source files (*.java) in your project's src folder, then use refactoring to change the package.
Right-click your java file, then select Refactor > Move and type your new package name.
I have 3 different packages, let's say :
com.pack.*
com.package.commons.*
com.package.app.*
The thing is, these 3 packages are in the same source folder and I can't move them.
My com.pack is completely independant, let's say it's my framework.
My com.package.commons can import classes from com.pack ONLY.
My last package can import whichever classes it needs.
In my eclipse project everything is thing as long as I'm the only one to develop, I know I can't import anything without checking first where it comes from.
But I work in a team and errors happen frequently, I've tried to make an Ant Build that will first build my framework then my commons (with the framework in it's CP during build time) and lastly my app. But I can't get any error from it.
Do you have any idea how I can perform these checks during build time or any other solution?
thanks
EDIT: I can't split in 3 projects even if it would be lot easier I know that!
Why don't you separate the project into three eclipse projects? If one package is completely independant, then (in my view) it doesn't belong into that project. And that goes to your package.common package as well. When it's a library project, then it could be separated thus implicitly solving your "separate build" problem.
As for the errors, I didn't could understand you well. What kind of errors do you mean? Import errors (e.g. visibility between packages) would be also generated when the project is divided into several projects with dependencies.