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

Error: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull #12

Open
rondey opened this issue Jun 7, 2019 · 5 comments

Comments

@rondey
Copy link

rondey commented Jun 7, 2019

Hi, I need to set an image rounded inside a TabView. I need to download an image from the web, to edit it and to save it. This is the code:

http.getImage("https://static.nanopress.it/nanopress/fotogallery/1200X0/240679/super-mario.jpg").then(imageSource` => {
  imageSource.saveToFile(this.path, "png");
  const filters = new ImageFilters();
  const image = new Image();
  image.src = this.path;
  filters.roundCorner(image, 50).then(img => {
    img.saveToFile(this.path, "png");
    this.profileTab = { iconSource: this.path };
  }).catch(error => {
    console.log(error);
  });
}).catch(error => {
  console.log(error);
});

The function "roundCorner" return this error:

Error: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter value
net.bradmartin.flexing.ImagesKt.getBitmapFromImageView(Unknown Source:2)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1120)
com.tns.Runtime.callJSMethodImpl(Runtime.java:1000)
com.tns.Runtime.callJSMethod(Runtime.java:987)
com.tns.Runtime.callJSMethod(Runtime.java:967)
com.tns.Runtime.callJSMethod(Runtime.java:959)
com.tns.gen.org.nativescript.widgets.Async_CompleteCallback.onComplete(Async_CompleteCallback.java:17)
org.nativescript.widgets.Async$Http$HttpRequestTask.onPostExecute(Async.java:573) org.nativescript.widgets.Async$Http$1$1.run(Async.java:304)
android.os.Handler.handleCallback(Handler.java:789)
android.os.Handler.dispatchMessage(Handler.java:98)
android.os.Looper.loop(Looper.java:164)
android.app.ActivityThread.main(Activi..

What's the issue?

@bradmartin
Copy link
Owner

My guess is the image isn't there when you pass it to the filter method. That's what the error says. It's null. Even though you set the src, if it's over the network it's very likely not loaded completed by the time the execution hits the next line.

So I would check for an async approach to setting the src before calling the filter.

@rondey
Copy link
Author

rondey commented Jun 8, 2019

The image is downloaded using the http function. It's an async call (look at the "then"), imageSource will contain the image loaded from the web when the line "imageSource.saveToFile(this.path, "png");" is reached. So the image is already there in the correct path.

Anyway, I tried to insert the filter call inside a timeout (10 seconds), but the error is still there

@bradmartin
Copy link
Owner

Gotcha. Where do you set this.path? And I'm going off the exception

Error: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter value
net.bradmartin.flexing.ImagesKt.getBitmapFromImageView(Unknown Source:2)

Which is telling us whatever is being passed to that method is null. Seems odd, might want to look at the source of that method and be sure the plugin isn't doing anything before calling the native lib.

@rondey
Copy link
Author

rondey commented Jun 8, 2019

Gotcha. Where do you set this.path? And I'm going off the exception

export class MainTabsComponent implements OnInit {
    private filename: string = "profile2.png";
    private path: string = fs.path.join(fs.knownFolders.documents().path, this.filename);

The image exist in that path, because if I launch this.profileTab = { iconSource: this.path }; before the filters.roundCorner line, the tab will have the image.

@bradmartin
Copy link
Owner

K. I don't have time to debug it but if you do, you can debug the source of that method when you run it to see what exactly is being passed to the method, would be good to confirm its not null, which would be weird since that's the exception

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