Java library cant resolve package - java

I added a library with several packages one of which is "no.stelar7.api.r4j.impl.lor". When I go to import this package to use it in my code I am given an error saying it can't be resolved, I have tried deleting the library and re-importing it with no luck and need any help. There is another package in the library called "no.stelar7.api.r4j.impl", is it possible this is causing me errors?

Check if the library available for your current java version

Related

How to import a package I found online in Java?

I am trying to use this class, but i'm having trouble importing it into my code. Anyone know it's not allowing me to import it? It is giving me a "Cannot resolve symbol 'edu'"
You'll find the details here
You need to download the .jarfrom https://search.maven.org/search?q=a:edu-mines-jtk, and add to your classpath,
on a IDE like IntelliJ : Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project
command line https://javarevisited.blogspot.com/2012/10/5-ways-to-add-multiple-jar-to-classpath-java.html
Or use maven, and just add the dependency : What does Maven do, in theory and in practice? When is it worth to use it?

NoClassDefFoundError at Runtime on class inside .AAR in Android Studio

I've been researching for many hours about a possible solution to this but whatever I try it just fails. Here's the explained situation:
I have this library project on Android Studio which generates the app-debug.aar file.
Then I add this new module in the implementing project, following the wizard to import .JAR/.AARs I pick the .aar and update the dependency for :app in the Project Structure.
Once the project is cleaned (even using ./gradlew clean--Mac OS X) I can make references of this class and its methods in any of the activities.
Now at runtime, once built and installed on the real devices the app will crash throwing the aforementioned Runtime Exception.
Note: I'm importing the .aar because I would need to protect the code and it has resources so a .jar is out of the question. And if I import the library module (with source and all instead of an.aar) then the app has no issues at runtime.
I've tried everything and if anyone can throw some light on what this could be, it'll be highly appreciated.
The class extends ViewGroup and is instantiated at runtime in case that implies anything. The code was given to me so major changes might not be possible unless it's absolutely necessary.
Thanks beforehand to all!
Armando
For those, who are still looking for the solution, following two options worked for me to solve the exact same problem as OP has mentioned.
Include the (problematic) library dependency in the target module as well, i-e the in my case i was including the protobuf-lite as a dependency to my library module but getting noclassdefFound error when lib imported as .aar in app module. As a workaround, i added the protobuf-lite dependency to my app module too and it worked like charm.
Second option that worked for me that instead of adding the gradle dependency `compile 'com.google.protobuf:protobuf-lite:3.0.1', i downloaded the protobuf-jar from maven and added manually to the libs of my library module, and the problem got solved.
Don't know what's wrong with the gradle plugin, but hope it helps someone else looking for the same problem.
The NoClassDefFound error has actually happening to a backward-compatibility library being used by this class I mentioned on the question ("Class A"). No details were given other than Class A couldn't be found and later on found out that another class had a similar issue BUT was pointing at that compat lib with the same exception and I noticed that Class A was also calling its methods and implementing its callbacks. By bumping up the min version (to use the native API) I could overcome that issue. It was indeed a problem of including that backward-comp library in the .aar or so it seems. Should I understand this issue a lot better I'll update this "answer."

The import com.android.datetimepicker cannot be resolved

I've imported an existing Android project to Eclipse, but I'm getting errors on the following imports:
import com.android.datetimepicker.time.RadialPickerLayout;
import com.android.datetimepicker.time.TimePickerDialog;
I already have the android-support-v4.jar library added to the build path.
Could anybody help me to figure out what is missing?
Neither of those classes exist in the Android SDK. There is a TimePickerDialog, as others have noted, in a different package. There is a RadialPickerLayout in the Android source code, and you are welcome to try to use it.
Really, you should be talking to whoever wrote this Android project and asking them where they were planning on getting those classes from.
If you have added the datetimepicker library where you have the package com.android.datetimepicker palced, please add the following to main project's build.gradle dependencies section:
compile project(':library')
This worked for me. Please let me know your comments.

Steps to resolve the imports in eclipse?

Firstly, I have seen several question related to this issue but it seems like those questions might be some steps ahead of my understanding.
I am fairly new to java and consider myself as a self learning beginner. Mostly I face this problem where I do an import. I need it because that import is linked with the use of some really nice and powerful function(s), but always fail if import does not work and end up not using that.
The message is, e.g. "The import com.google can not be resolved".
I have been using eclipse in Ubuntu.
After trying some of the given solutions without being able to view them in the proper context, I already have messed up my eclipse environment and the trouble is still there.
Can anybody kindly show me the complete steps of doing these imports successfully in eclipse for java?
For using 3rd party jars you need to add the jars in the build path.
Follow the following step
right click project
click build path
click libraries tab
then add external jar
Now give the path of the jar location

EdgeType.DIRECTED not working

I recently figured out how to add the Jung libraries to eclipse, but now I ran into a new problem. I'm using the Jung tutorial and I can't seem to run the first tutorial, because the Eclipse IDE is saying that the .DIRECTED ,in the code, cannot be resolved or is not a field. How do I fix this?
edit: Yes, using that package worked! However, I'm surprised that the Eclipse IDE did not offer to import the package for me. Is this unusual?
Make sure to include all the required JUNG2 libraries into your Eclipse project. When you do that, Eclipse will give a few suggestions after you right-click on those yellow-underlined words. Choose the one(s) related to JUNG2 to remove the warning(s).
EgeType.DIRECTED must be imported from edu.uci.ics.jung.graph.util.EdgeType package which is under jung-graph-impl-2.0.1.jar

Categories