Add library to Android Studio and import in class - class

I would like to import the following library : https://github.com/jOOQ/jOOU
into my project so i can use the UByte/ULong... types as attributes the same way u can import and call a ByteBuffer for example. I followed this tutorial : How do I add a library project to Android Studio? but it didn't work and it kept telling me that it couldn't find the path to the file.

please Go to: File > New > Import Module .. select your downloaded Library
then Go to : File > Project structure > select App > dependencies tab > + Dependency Module Like in the this pic:
Update
ok, after taking a look at the library, just try to copy" jOOU/jOOU/src/main/java/org/joou/" folder inside one of your packages and it will work

Related

Error: Could not resolve the package 'app' in 'package:app/app_controller.dart

In my last flutter project, I included files placed in my lib/ directory by using import 'package:app/file_name.dart'.
For example, my file located at lib/app_controller.dart was imported via:
import 'package:app/app_controller.dart'
I just started a new flutter project, and it is giving me the error:
Error: Could not resolve the package 'app' in 'package:app/app_controller.dart'
When I remove the portion package:app/, it builds fine. I find this very strange because my previous project is still building just fine without any changes. Does anyone know what's happening here?
What is allowing my old project to respect package:app/..., but not my new project?
package:app/ would work only for an application that is called app. What is the name of your new application? When you import items from your own project, it goes like this:
package:{{YOUR APPLICATION NAME}}/{{DIRECTORIES}}
What is the name in your pubspec.yaml file? It's usually on the very first line.
it is because a dart class can be imported in two ways(AFAIK),
local import from the root of current file where import is being used for example import '../folder/file.dart
with a package name which should begin from package for example import package:packagename/any_file_in_the_lib_folder.dart, a package will have a pubspec.yml which defines a package name which will be used to import the content of the lib folder of that package, in your case your first project is named app so it respected this import style but your second project isn't respecting it because its not named app but something else.

Flutter NFC reader plugin does not work with error inside plugin

I'm trying to make a flutter version of my old app , it needs NFC .
First I create a default project for test run and it works fine.
I tried to use flutter-nfc-reader and install it following "Installation" in that default project.
And here comes the problem:
After I edit "pubspec.yaml" and do "packeges get" , it automatically edit "GeneratedPluginRegistrant" under "myapp/android/app/src/main/java/io.flutter.plugins".
added
import it.matteocrippa.flutternfcreader.FlutterNfcReaderPlugin;
and
FlutterNfcReaderPlugin.registerWith(registry.registrarFor("it.matteocrippa.flutternfcreader.FlutterNfcReaderPlugin"));
But the import can't find that package "it.matteocrippa.flutternfcreader" which is inside the plugin.
I tried just copy that package but that file will be full of error when it is inside my project.
I have no idea how to fix it....
As Github reads:
last step import to the project:
import 'package:flutter_nfc_reader/flutter_nfc_reader.dart';

Can't import the Svg library in elm?

Trying to use Svg and Svg.Attributes. Getting the error message
I cannot find module 'Svg'.
Module 'Main' is trying to import it.
Potential problems could be:
* Mispelled the module name
* Need to add a source directory or new dependency to elm-package.json
I'm certain that there aren't any spelling errors because I copy and pasted the imports from a tutorial. Where do I install this library?
The tutorial I'm going through is the one elm-lang.org, specifically the section on time.
You need the elm-lang/svg package as a dependency in your elm-package.json. Run elm package install elm-lang/svg in the project directory.

Can't use class from .jar in Build Path

I have two Android workspaces, and I would like to use the same class for both. I want to import instead of just copy and paste the class (just to learn how to import .jar and/or the classpath folder).
Creating my .jar
On my first Android application:
right click on my project folder --> Export... --> Java --> JAR File --> Next
Then this is what would come up:
Then I click finish.
There are 20+ classes in that app, but one of them is CopyPaste.java located like so in my project:
Calculator\src\com.mikeyaworski.calculator\CopyPaste.java
Adding .jar to build path (other workspace)
right click on project folder --> Build Path --> Configure Build Path... --> Libraries --> Add External JARs... and then I choose it.
It'll look like this afterward:
Using a class from the .jar
I add this import statement:
import com.mikeyaworski.calculator.CopyPaste;
But it gives me the error:
The import com.mikeyaworski.calculator.CopyPaste cannot be resolved
Then I would just try to create an instance of the class like this:
CopyPaste c = new CopyPaste(getApplicationContext());
Questions
How can I get rid of that error?
If I add an External Class Folder to the build path instead, how can I use that to use a class? I've done that, but I don't know how to import the class from the class folder to my other class.

cant compile ast parser code in java

I have some ast parser code in eclipse but I am unable to import the
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
packages.
could some body tell me which jar file to download and where to add same that jar file in eclipse folder.
You probably have those files downloaded already in eclipse\plugins folder i.e. in windows C:\Program Files\eclipse\plugins\org.eclipse.jdt.core_3.9.1.v20130905-0837.jar
Of course you can download from internet as well
http://central.maven.org/maven2/org/eclipse/tycho/org.eclipse.jdt.core/
Note that in order to run it as a stand alone application you will have to import such librariers (where xx stands for version and again they can be found in eclipse\plugins folder):
org.eclipse.core.contenttype_xx.jar
org.eclipse.core.jobs_xx.jar
org.eclipse.core.resources_xx.jar
org.eclipse.core.runtime_xx.jar
org.eclipse.equinox.common_xx.jar
org.eclipse.equinox.preferences_xx.jar
org.eclipse.jdt.core_xx.jar
org.eclipse.osgi_xx.jar
Usually people add other libraries in folder called lib but still you will have to set it in eclipse. In order to do that right click on your project then build path -> configure build path -> libraries and select add JAR.