I want to build a Cordova plugin for Ionic app, and this plugin I think I have already imported the library (here is the java code, as you can see I write the import statement)
package session;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.util.Log;
import android.Manifest;
import android.os.Handler;
import android.javax.sip.Dialog;
import java.lang.ref.WeakReference;
public class MediaSipSession extends CordovaPlugin{
private static String TAG = "MediaSipSession";
public static CallbackContext callCallback;
private CallbackContext RTCPCallbackContext;
private Dialog dialog;
And I also add the source-file tag in my plugin.xml ( android-jain-sip-ri-1.2.342.jar have the class which name android.javax.sip)
<source-file src="libs/android-4.1.1.4.jar" target-dir="libs/android-4.1.1.4.jar"></source-file>
<source-file src="libs/android-jain-sip-ri-1.2.342.jar" target-dir="libs/android-jain-sip-ri-1.2.342.jar"></source-file>
so I run ionic Cordova build android, expect Ionic will build an android APK for android platform, but I get the error, it say
error: package android.javax.sip does not exist
import android.javax.sip.Dialog;
symbol: class Dialog
location: class MediaSipSession
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
hope anyone can fix this problem.
I found the way to solve this problem.
If you want to use the library, should use the lib-file tag to define the .jar file, not the source-file tag : )
Related
I'm using for the first time awsglueml package to use the class FillMissingValues. I'm using Glue 3.0 importing the ML package as mentionned by the documentation:
from awsglueml.transforms import FillMissingValues
...
dyf = FillMissingValues.apply(dyf, "demographic", output_column="demographic")
And I got an import error:
from awsglueml.transforms import FillMissingValues
ImportError: cannot import name 'FillMissingValues' from 'awsglueml.transforms' (/opt/amazon/lib/python3.6/site-packages/awsglueml/transforms/__init__.py)
Why does the latest Glue version is not up-to-date with the latest documentation? FillMissingValues should be in the awsglueml/transform package.
I am new to Angular Dart. I have installed Dart, and added dart plugin in VS code. Then I created a bare bone project thru VS command pallette. But when I added this line in main.dart, I got build error. It is as recommended by angular dart i.e
angular dart
Here is my main.dart file.
import 'dart:html';
import 'package:angular/angular.dart';
import 'package:angular_web_application/app_component.dart' as ng;
import 'package:http/browser_client.dart';
#GenerateInjector([
ClassProvider(Client, useClass: BrowserClient),
])
void main() {
runApp(ng.AppComponentNgFactory);
}
Here is my app_component.dart
import 'package:angular/angular.dart';
#Component(
selector: 'my-app',
template: '<h1>Hello {{name}}</h1>',
)
class AppComponent {
var name = 'Angular';
}
In my index.html, I have this line
<my-app>Loading</my-app>
But I am facing build error for the line
runApp(ng.AppComponentNgFactory);
I get this error:
"message": "The name 'AppComponentNgFactory' is being referenced through the prefix 'ng', but it isn't defined in any of the libraries imported using that prefix.\nTry correcting the prefix or importing the library that defines 'AppComponentNgFactory'.
The factory is not declared in the app_component.dart.
It is generated by Angular compiler
import 'package:angular_web_application/app_component.template.dart' as ng;
Which should have the right implementation.
See What does somecomponent.template.dart import in AngularDart point to? for example.
I found myself written tedious code when importing files into dart files like the following:
import '../../constants.dart';
I'm wondering if there is any way to create an alias to specific folder like:
import '#shared/constants.dart';
Thanks,
Javi.
Dart doesn't allow you to rename imported identifiers, but it allows you to specify an import prefix
import '../../constants.dart' as foo;
...
foo.ImportedClass foo = foo.ImportedClass();
It allows also to filter imported identifiers like
import '../../constants.dart' show foo hide bar;
See also
https://www.dartlang.org/guides/language/language-tour#libraries-and-visibility
What is the difference between "show" and "as" in an import statement?
Barrel files can also make importing easier like
lib/widgets/widgets.dart
export 'widget1.dart';
export 'widget2.dart';
export 'widget3.dart';
export 'widget4.dart';
lib/pages/page1.dart
import '../widgets/widgets.dart';
Widget build(BuildContext context) => Widget1();
No. Dart do not have import alias.
But you have absolute imports which makes up for it:
import 'package:my_lib/shared/constants.dart
This will import the file /lib/shared/constants.dart
I am on angulardart 0.11.0 and this is my code for main.dart:
library my_app_main;
import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';
import 'package:my_app/src/something.dart';
class MyModule extends Module {
MyModule() {
bind(MyAppCtrl);
bind(MyComp);
}
}
main() {
applicationFactory()
.addModule(new MyModule())
.run();
}
I get syntactic errors:
angular.dart import is 'unused'
'Module' is an 'undefined class'
I have tried deleting and rebuilding the packages directory, pubspec file, etc. What is going on?
angular.dart import is 'unused' is just a warning, so you don't really need to worry about it.
You're seeing 'Module' is an 'undefined class' because you're not importing the di library. Add
import 'package:di/di.dart'; to your imports and it should run.
Turns out the error was caused by the angular files becoming corrupted in the pub cache. As was pointed out here (https://groups.google.com/forum/#!topic/angular-dart/WiZuIwxTDb4) - thanks Günter! - the solution is to repair the pub cache by doing 'pub cache repair' or at least 'pub cache add angular'
I need to import the fallowing,But in blackberry there is no predefined imports as i need.
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javacard.framework.SystemException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.kobjects.base64.Base64;
all these shows error.
When i add jar6 library it does n't show any error but i got packing failed.
I need to import these files.
can any one please post how can i import these files.
Thank u in advance.
BlackBerry uses J2ME which is Java 1.3. You won't be able to use Java 6 classes. Instead you should look at the BlackBerry API. It has classes for encryption but you'll need to rewrite your code to use them.