Angular-Meteor package on Android device is throwing "Unexpected token <" - android

I was able to run my Angular-Meteor Cordova application no problem until I made a minor change. Now whenever I run meteor run android-device it tries to start the application on the device but when it starts has trouble loading the packages. This is the log out put:
=> App running at: http://localhost:3000/
=> Started app on Android Device.
I20160308-12:51:21.879(0) (android:http://meteor.local/packages/angular_angular.js:1) Uncaught SyntaxError: Unexpected token <
I20160308-12:51:21.954(0) (android:http://meteor.local/packages/angular_angular-animate.js:32) Uncaught TypeError: Cannot read property 'noop' of undefined
I20160308-12:51:21.955(0) (android:http://meteor.local/packages/angular_angular-sanitize.js:42) Uncaught TypeError: Cannot read property '$$minErr' of undefined
I20160308-12:51:21.955(0) (android:http://meteor.local/packages/angularui_angular-ui-router.js:49) Uncaught TypeError: Cannot read property 'isDefined' of undefined
I20160308-12:51:22.359(0) (android:http://meteor.local/packages/driftyco_ionic.js:13355) Uncaught ReferenceError: angular is not defined
...
Oh, I should say this runs on the desktop fine.
----- Update -----
I've inspected the WebView with Chrome and weirdly enough the offending file angular_angular.js seems to contain HTML! See picture below:
This is totally different from the contents of the same file on the desktop, which contains valid javascript.

After inspecting the webview via Chrome I discovered the mobile was using old application files. Answer was to go into the settings -> apps -> myapp and clear the cache/local files.
I thought this would have been expired by meteor but it's not the case. Or perhaps it didn't do it one time because of an error. I'll find out soon enough, but if not I'll have to figure out a way to stop the caching of obsolete files.

Related

Expo notifications can't call `getExpoPushTokenAsync()`

Am currently trying to setup notifications on my managed expo project
Expo version 47.0.0
Expo notifications version 0.17.0
Device: Samsung Galaxy s10
Android version 12
I am currently just trying to get the basic setup itself working and retrieve my devices push token. This should be done using Notifications.getExpoPushTokenAsync() as described here.
The Problem
My error is strange, when I call getExpoPushTokenAsync it does indeed get me the expo push token, however shortly after my app crashes with the following messages
ERROR TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[1], "../../../src/util").types.isPromise')
WARN [expo-notifications] Error encountered while updating server registration with latest device push token. [TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[5], "#ide/backoff").computeNextBackoffInterval')]
I have tried
re-installing node_modules and expo-notifications but still get the same.
I can definitely see the #ide/backoff package is installed in my node_modules.
I also followed these instructions to setup firebase in app, even though my understanding is that it should work out of the box in expo go app while devving.
One other interesting thing is that I can call Notifications.getDevicePushTokenAsync() fine with no error. But still get the same error if i pass that in to getExpoPushTokenAsync method after. At a surface level it seems like somehow the request out to expo services to get the expo push token is both passing and failing 🤷‍♂️
const devicePushTokenResponse = await Notifications.getDevicePushTokenAsync();
const expoPushTokenResponse = await Notifications.getExpoPushTokenAsync({
devicePushToken: devicePushTokenResponse,
}); // <--- Returns token & errors a few seconds later
Couldn't see any other posts with this error and expo-notifications, so would be keen to see if anyone else has ran into / fixed a similar issue recently
Cheers
Alright I figured it out, it was somewhat hinted at by this line
ERROR TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[1], "../../../src/util").types.isPromise')
And more specifically the fact that a node_modules dependency is referencing 3 levels up in the file system.
The solution
Turns out that for some reason my module resolver (defined in babel.config.js) was resolving my project's util folder instead of the packages util folder. I think this was compounded by my metro config making use of the inlineRequires functionality to improve performance (see more)
I am sure there is some actual config that could be updated to exclude node_modules from using inline requires (i did try use a blocklist to no avail), but as an interim, i was able to get it working fine by changing the path of my util folder to be #my-project/util so that it avoids future collisions.
Hope this helps anyone who runs into the same issue in the future :)

Unable to load ExtJS on cordova android through cordova app loader : addRow is not defined

Shorter version of the story which i am trying to do : Load a Web application on cordova runtime through cordova app loader.
The webapp is built on ExtJS
Process
ExtJS app is getting built.
bootstrap.js is getting generated for microloader concept.
manifest.json is generated
Cordova app is able to download and load the external web app.
When tried on android and iOS, the iOS version is working perfectly well but the android version throws several errors.
(index):1 Uncaught ReferenceError: start is not defined
at (index):1
(index):2 Uncaught ReferenceError: onHasParentDirectory is not defined
at (index):2
(index):3 Uncaught ReferenceError: addRow is not defined
at (index):3
(index):4 Uncaught ReferenceError: addRow is not defined
at (index):4
(index):5 Uncaught ReferenceError: addRow is not defined
at (index):5
(index):6 Uncaught ReferenceError: addRow is not defined
at (index):6
(index):7 Uncaught ReferenceError: addRow is not defined
at (index):7
(index):8 Uncaught ReferenceError: addRow is not defined
at (index):8
On further inspection it seems this is related to how the webview works in android and how it has problems with Hashes.
Some responses from links :
- The problem is due to the link (href) with prefix “/#/xxxx” rather than “#/xxxx” …
-file:///android_asset/www/main.html#" + strippedUrl; where strippedUrl means the original url with file:/// converted to just / and with potential /android_asset/www converted to an empty string, there seems to be an issue in the 4.0 Webview related to html5 routing and paths starting with /.
Reference Links :
https://gist.github.com/morganrallen/f955cc0312ae2cdbe9a5
https://forum.ionicframework.com/t/uncaught-referenceerror-addrow-is-not-defined/9266/3
To try in that approach i tried implementing the hashbang approach, but still application fails in android.
Can any one let me know how to work around these errors or what possible solution can be there.
P.S : if i work without routing in ExtJS, the application works perfectly. Errors are not in ExtJS project.
Thanks and Regards
I solved the issue by specifying path with index.html on it.
Earlier it was
downloadedAppUrl = fileSystem.root.nativeURL + 'app';
Now i specified
downloadedAppUrl = fileSystem.root.nativeURL + 'app/index.html';

How to get the full information of runtime error instead of <Timeout exceeded getting exception details>?

So I'm trying out xamarin in VS2017, but found this undhandled error:
Unhandled Exception:
Java.Lang.SecurityException: <Timeout exceeded getting exception details>
This is very clueless. How can I get the full information of the runtime error like in Android Studio?
I had the same problem while calling some native API,
solved it by
Put a try catch around the block of got which is throwing the error.
Put a breakpoint in the catch block, you can get actual details of the exception.
After getting assistance from Microsoft, I finally found the solution.
TL;DR
Use VS Android device log and filter with "mono-rt" or "Error"
Complete Answer:
There are 2 solution:
1. Using Android Studio logcat:
Open the Android Studio logcat (View > Tool Windows > Logcat). From the logcat window, choose the device, choose the Xamarin.Android deployed application, and choose logcat for Error
Android logcat will display the runtime error:
2. Using Visual Studio Android Device Log:
Open the Visual Studio Android Device Log(Tools > Android > Device Log).
Here is the tricky bit: Unlike Android Studio, VS list all of the device log, not limited to the Xamarin.Android app deployed. So somehow we have to use the filter to get the relevant information. The problem is, what filter should we use? I used my application name and the error didn't show up. It turns out that when the error happen, the log doesn't contain any of the application name. Instead it has "mono-rt" tag with "Error" type.
So there you have it. Filter it with "mono-rt" tag or "Error" type and you will find the error information

"Uncaught SyntaxError: Unexpected identifier" on Android 4.4.2 but not Android 4.3

There's a webview in my app that is passed the URL to the local files in the /assets/ folder, however, I get this useless error in logcat :
04-28 18:22:20.650: I/chromium(28903): [INFO:CONSOLE(1)] "Uncaught
SyntaxError: Unexpected identifier", source:
file:///android_asset/webpage/localpg/ (1)
It's useless to me because it doesn't state in what file the error is: within the "localpg" folder there are 3 files: .css, .html, and .js (note: the javascript file is HUGE!! It would be impossible to go through that file and spot a syntax error)
Is there a setting in the webview that makes the error more verbal ?
It should be noted that in Android 4.3, the local webpage within /assets/ works great.
Also, I've tried using the ADB Plugin in Chrome to find the webview on the device - but no dice! I can't inspect it !

Error while trying to apportable iOS app to Android

I have been trying to port my first iOS app to Android with apportable.
I have solved alot of warnings and errors but cannot get rid of this last one.
The App I made is a fitness application for jogging so it uses CoreLocation.
Everything looks good when I run apportable now except this last error:
Build/android-armeabi-debug/com.apptonix.easyrunner/testTabbedWithCore/libtestTabbedWithCore.a(DetailViewController.m.o):/Users/peterbodlund/Documents/xcodeprojects/Training/inlamning5/testTabbedWithCore/testTabbedWithCore/DetailViewController.m:function L_OBJC_CLASSLIST_REFERENCES_$_114: error: undefined reference to 'OBJC_CLASS_$_MKPinAnnotationView'
scons: * [Build/android-armeabi-debug/EasyRunner/apk/lib/armeabi/libverde.so] Error 1
scons: building terminated because of errors.
Exception AttributeError: "'NoneType' object has no attribute 'pack'" in > ignored
Usually this is an indicator that there were link errors. Check your output higher up and look for missing symbol errors.
The build log is confusing because the build is parallel by default.
Add the option -j1 to cause the build to stop immediately after the first error.

Categories

Resources