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

Only Android: Uncaught (in promise): Error: Cannot convert number to Ljava/lang/String; at index 1 #249

Closed
AklsKiu opened this issue Oct 15, 2019 · 4 comments · Fixed by #252
Assignees

Comments

@AklsKiu
Copy link

AklsKiu commented Oct 15, 2019

JS: ERROR Error: Uncaught (in promise): Error: Cannot convert number to Ljava/lang/String; at index 1
JS: Error: Cannot convert number to Ljava/lang/String; at index 1
JS: at getMultipartRequest (file:///node_modules/nativescript-background-http/background-http.js:261:0)
JS: at Function.push.../node_modules/nativescript-background-http/background-http.js.Task.createMultiPart (file:///node_modules/nativescript-background-http/background-http.js:162:0)
JS: at Session.push.../node_modules/nativescript-background-http/background-http.js.Session.multipartUpload (file:///node_modules/nativescript-background-http/background-http.js:132:0)
JS: at file:///src/app/services/rest/rest.service.ts:232:25
JS: at new ZoneAwarePromise (file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:902:0)

@project-bot project-bot bot added this to Inbox in Plugins Team Oct 15, 2019
@kriefsacha
Copy link

I have the same with " Cannot convert object to Ljava/lang/String; at index 0". Did you find a solution @AquilesOliveira

@romulowspp
Copy link
Contributor

romulowspp commented Oct 22, 2019

I think that this problem happen when you try to pass a non string value in parameter.

const params = [ { name: 1, value: 1 }, { name: "fileToUpload", filename: this.file, mimeType: 'image/jpeg' }];

request.addParameter(params[i].name, params[i].value);

I will test more to make sure that this is the problem.

romulowspp added a commit to romulowspp/nativescript-background-http that referenced this issue Oct 23, 2019
Convert param to string before send to Java method

Referenced in NativeScript#249
@AklsKiu
Copy link
Author

AklsKiu commented Oct 24, 2019

I have the same with " Cannot convert object to Ljava/lang/String; at index 0". Did you find a solution @AquilesOliveira

The quickest and simplest solution is to form the string variable as @romulowspp said and until the correction comes out, I'm using it this way.

Thanks @romulowspp!!!!

@VladimirAmiorkov VladimirAmiorkov self-assigned this Oct 25, 2019
@VladimirAmiorkov VladimirAmiorkov moved this from Inbox to In Progress in Plugins Team Oct 25, 2019
Plugins Team automation moved this from In Progress to Done Oct 25, 2019
VladimirAmiorkov pushed a commit that referenced this issue Oct 25, 2019
* fix(android-upload): Fix some params vars to be a string

Convert param to string before send to Java method

Referenced in #249

* fix(android-upload): Remove missing lock files

Removed missing lock files that i forget in before commit

Referenced in issue 249
@VladimirAmiorkov VladimirAmiorkov moved this from Done to Review / QA in Plugins Team Oct 25, 2019
Plugins Team automation moved this from Review / QA to Inbox Oct 25, 2019
@VladimirAmiorkov VladimirAmiorkov moved this from Inbox to Review / QA in Plugins Team Oct 25, 2019
@zbranzov
Copy link
Contributor

zbranzov commented Nov 1, 2019

The fix is released in nativescript-background-http@4.2.1

@zbranzov zbranzov closed this as completed Nov 1, 2019
Plugins Team automation moved this from Review / QA to Done Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Plugins Team
  
Done
Development

Successfully merging a pull request may close this issue.

5 participants