PeterStaev / nativescript-azure-mobile-apps

:cloud: NativeScript plugin for working with Microsoft Azure Mobile Apps services
Apache License 2.0
30 stars 10 forks source link

TypeError: Cannot read property 'windowsazure' of undefined #6

Closed georgeedwards closed 8 years ago

georgeedwards commented 8 years ago

I have been working with the plugin for a while and all of a sudden, the error below has appeared, causing my app to crash. I don't think it is because of something in my app necessarily, as when I revert to a previously working version from my source control, the same issue shows. Any idea what's causing this?

java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: 
Fail to load module: /data/data/org.nativescript.AzureTest/files/app/main.js

TypeError: Cannot read property 'windowsazure' of undefined
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'', file:'/data/data/org.nativescript.AzureTest/files/app/tns_modules/nativescript-azure-mobile-apps/client/client.js', line: 24, column: 98
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.AzureTest/files/app/Components/Home/home.component.js', line: 8, column: 16
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.AzureTest/files/app/app.component.js', line: 5, column: 24
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'/data/data/org.nativescript.AzureTest/files/app/main.js', line: 4, column: 23
    Frame: function:'require', 

It looks like the issue line is: client.android.js:

nativeAuthenticationProviders[user_1.AuthenticationProvider.AzureActiveDirectory] = com.microsoft.windowsazure.mobileservices.authentication.MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory;

PeterStaev commented 8 years ago

Hey @georgeedwards , yes this seems the line which cause the error. Are you sure you have not somewhere in your code defined some variable com.microsoft? Also you can try to clean the platforms folder and then re-add the android platform.

georgeedwards commented 8 years ago

@PeterStaev Yes, I have tried re-adding the android platform, but I still get the same response. If I search for com.microsoft, the only hits are the plugin ones and the gradle file.

PeterStaev commented 8 years ago

Then, sadly I have no idea :( Try to debug it with VS code and see why com.microsoft is not initialized. Also seems you are using Angular, so may be something related to that, but i have 0 experience with NG...