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

Cannot read property 'uploadservice' of undefined #11

Closed
mikeres0 opened this issue Feb 15, 2016 · 16 comments
Closed

Cannot read property 'uploadservice' of undefined #11

mikeres0 opened this issue Feb 15, 2016 · 16 comments
Labels

Comments

@mikeres0
Copy link

I am attempting to use this plugin within my app, however I receive an error upon navigating to the page where the plugin is required. The error I receive is Cannot read property 'uploadservice' of undefined which relates to line 8 of background-http.js.

@PanayotCankov
Copy link
Contributor

Can you add the plugin using tns plugin add nativescript-background-http then delete the platforms folder and re-run for android? The fails seem to happen very early at obtaining com.alexbbb.uploadservice which seems the underlying native android implementation didn't make it to your app. Possible problems may be the plugin was added using npm install rather than tns plugin add, or the Android gradle may have mis-cached the metadata prior to adding this library.

Please write back if cleaning platforms and tns plugin add do not fix the problem so we can investigate it further.

@mikeres0
Copy link
Author

Which platforms folder? As in node_modules/nativescript-background-http/platforms or the platforms directory at the root of my project?

@PanayotCankov
Copy link
Contributor

The one at the root of your project.

@mikeres0
Copy link
Author

No luck unfortunately, I'm still receiving the same error message

@PanayotCankov
Copy link
Contributor

I can not reproduce the problem. Can you share the versions of the NativeScript framework you are using tns --version and provide the versions in the pakcage.json? Also do you test on device or emulator?

@mikeres0
Copy link
Author

My CLI version is 1.6.2 and the versions in my package.json are as follows:

{
    "nativescript": {
        "id": "org.nativescript.nextraworkplan2",
        "tns-ios": {
            "version": "1.6.0"
        },
        "tns-android": {
            "version": "1.6.2"
        }
    },
    "dependencies": {
        "nativescript-background-http": "0.0.3",
        "nativescript-insomnia": "^1.1.0",
        "nativescript-local-notifications": "^1.0.0",
        "nativescript-sqlite": "^1.0.7",
        "node-uuid": "^1.4.7",
        "tns-core-modules": "^1.6.0"
    }
}

I am testing on two physical devices; Samsung Galaxy S5 and iPad Air.

@PanayotCankov
Copy link
Contributor

iPad Air shouldn't generate a Cannot read property 'uploadservice' of undefined message. What is the error on iOS? Also what is the android version installed on the Galaxy S5? I think we have S5 and will give it a try but there may be differences in the API level.

@mikeres0
Copy link
Author

I may be wrong about iOS. As I don't have access to that device today I won't be able to confirm.

The android version of the S5 is 5.0. Okay, thank you.

@viniciodeltoro
Copy link

I have the exact same error in my nativeScript app, I'm using a Nexus 5X on the emulator. I tried deleting the platforms folder and adding the plugin.
Any ideas on how can I fix that?

Thank you

@anchetaWern
Copy link

same problem here. I tried installing with npm and tns plugin add but I still get the same error.

@chief10
Copy link

chief10 commented Sep 2, 2016

Same error here. Running in Genymotion; Android 7.0

@viniciodeltoro
Copy link

I ended up using the regular HTTP module that angular 2 provides and uploading the image as a Based64 string in a JSON object. I convert back that string on the server side. That works very good but obviously it's not working in the backgroud

@joona
Copy link

joona commented Sep 4, 2016

I running into the same problem. Testing on Genymotion, Android 6.0 and on Nexus 6P with Android 7.0.

"nativescript": {
  "tns-android": {
    "version": "2.2.0"
  }
}

@Daxito
Copy link
Contributor

Daxito commented Oct 14, 2016

+1
Same problem here, Using {N} 2.3.0, everything 2.3.0, real device, a galaxy S5, no ideas then?

Daxito pushed a commit to Daxito/nativescript-background-http that referenced this issue Oct 14, 2016
PanayotCankov added a commit that referenced this issue Oct 20, 2016
@PanayotCankov
Copy link
Contributor

Try 2.4.0, aar has been replaced with include.gradle

@felixkrautschuk
Copy link

When updating to the latest version of this plugin (2.5.0), I get the same error message on Android.
Cannot read property 'uploadservice' of undefined

I am using tns-core-modules 2.5.0.

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

No branches or pull requests

8 participants