Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using share image function error return #27

Open
yclau opened this issue Nov 26, 2017 · 2 comments
Open

using share image function error return #27

yclau opened this issue Nov 26, 2017 · 2 comments

Comments

@yclau
Copy link

yclau commented Nov 26, 2017

Hi,
I generate QR image and pass to shareImage function then return the error below. And i try get from File or from website ,also cause this error.

System.err: Error: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
System.err: android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:583)
System.err: android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:557)
System.err: android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:399)
System.err: com.tns.Runtime.callJSMethodNative(Native Method)
System.err: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1084)
System.err: com.tns.Runtime.callJSMethodImpl(Runtime.java:966)
System.err: com.tns.Runtime.callJSMethod(Runtime.java:953)
System.err: com.tns.Runtime.callJSMethod(Runtime.java:937)
System.err: com.tns.Runtime.callJSMethod(Runtime.java:929)
System.err: com.tns.gen.java.lang.Object_frnal_ts_helpers_l58_c38__ClickListenerImpl.onClick(Object_frnal_ts_helpers_l58_c38__ClickListenerImpl.java:12)
System.err: android.view.View.performClick(View.java:5280)
System.err: android.view.View$PerformClick.run(View.java:21239)
System.err: android.os.Handler.handleCallback(Handler.java:739)
System.err: android.os.Handler.dispatchMessage(Handler.java:95)
System.err: android.os.Looper.loop(Looper.java:224)
System.err: android.app.ActivityThread.main(ActivityThread.java:5526)
System.err: java.lang.reflect.Method.invoke(Native Method)
System.err: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
System.err: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
System.err: File: "file:///data/data/org.nativescript.bungkus/files/app/tns_modules/nativescript-social-share/social-share.js, line: 43, column: 65

@EddyVerbruggen
Copy link
Collaborator

Which device / Android version is this? And can you share the code?

@yclau
Copy link
Author

yclau commented Nov 27, 2017

android version : 7.0
device : sony z2
JS file

var imageSource = require('image-source');
var context,closeCallback , img;
var ZXing = require('nativescript-zxing');
var SocialShare = require("nativescript-social-share");
var zx = new ZXing(); 
var myimage;
exports.onShownModally = function (args) {
    var page = args.object;
    context = args.context;
    closeCallback = args.closeCallback;
    img = page.getViewById("qrcode");
    var newImg = zx.createBarcode({encode: context.orderid.toString(), height: 100, width: 100, format: ZXing.QR_CODE}); 
    myimage = imageSource.fromNativeSource(newImg);
    img.src = myimage; 
}

exports.onNavBtnTap = function () {
    closeCallback();
}

exports.onShare = function (args) {  
  // 1)  SocialShare.shareImage(img.imageSource); 
  // 2)  SocialShare.shareImage(myimage);
}

XML

<Page xmlns="http://schemas.nativescript.org/tns.xsd" shownModally="onShownModally" backgroundColor="transparent">
    <GridLayout rows="auto,auto" columns="*" horizontalAlignment="center" verticalAlignment="center" backgroundColor="#ffffff" margin="20" borderRadius="10">
        <Image id="qrcode" horizontalAlignment="center"/>
        <Button  text="&#xf1e0;   Share Your QrCode" class="fa" tap="onShare" row="1"/>
    </GridLayout>
</Page>

package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.nativescript.client",
    "tns-android": {
      "version": "3.4.0-2017-10-31-1"
    }
  },
  "dependencies": {
    "nativescript-camera": "^3.1.4",
    "nativescript-directions": "^1.1.0",
    "nativescript-fonticon": "^1.1.1",
    "nativescript-geolocation": "^3.0.0",
    "nativescript-google-maps-sdk": "^2.4.3",
    "nativescript-localize": "^2.0.1",
    "nativescript-localstorage": "^1.1.5",
    "nativescript-phone": "^1.3.1",
    "nativescript-plugin-firebase": "^5.0.1",
    "nativescript-pro-ui": "^3.1.4",
    "nativescript-slideshow-busy-indicator": "^3.0.1",
    "nativescript-social-share": "^1.5.0",
    "nativescript-theme-core": "~1.0.2",
    "nativescript-zxing": "^1.5.2",
    "tns-core-modules": "^3.3.0"
  },
  "devDependencies": {
    "babel-traverse": "6.4.5",
    "babel-types": "6.4.5",
    "babylon": "6.4.5",
    "lazy": "1.0.11",
    "nativescript-dev-android-snapshot": "^0.*.*"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants