I’m having an issue with my Iconic 2 app I just started developing. I’m previewing the app through Ionic View, but it crashes when I make a call to the MediaCapture API (from Ionic Native). It only produces this error on the Android device I’m using - the iOS device works fine…
I’m now installing Android Studio and want to attach some sort of debugger to the Android device to extract logs or stack trace. I imagine it might not work since I’m not developing Ionic View, but my own app running inside Ionic View.
Has anyone stumbled across this problem? I would appreciate any help I can get
So I’ve managed to pull some logs from the phone using ADB (Android Debugging Bridge). I installed Android SDK and the plugin Android Platform Tools where ADB is one of the tools.
Using adb logcat I could see the traces for everything going on in the phone, so I extracted this from the logs:
01-29 12:30:02.828 14314 14347 E AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
01-29 12:30:02.828 14314 14347 E AndroidRuntime: Process: com.ionic.viewapp, PID: 14314
01-29 12:30:02.828 14314 14347 E AndroidRuntime: Theme: themes:{}
01-29 12:30:02.828 14314 14347 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'org.apache.cordova.file.LocalFilesystemURL org.apache.cordova.file.FileUtils.filesystemURLforLocalPath(java.lang.String)' on a null object reference
01-29 12:30:02.828 14314 14347 E AndroidRuntime: at org.apache.cordova.mediacapture.Capture.createMediaFile(Capture.java:486)
01-29 12:30:02.828 14314 14347 E AndroidRuntime: at org.apache.cordova.mediacapture.Capture.onVideoActivityResult(Capture.java:445)
01-29 12:30:02.828 14314 14347 E AndroidRuntime: at org.apache.cordova.mediacapture.Capture$1.run(Capture.java:327)
01-29 12:30:02.828 14314 14347 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
01-29 12:30:02.828 14314 14347 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
01-29 12:30:02.828 14314 14347 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
I looked up this code in the repository:
Not sure where to continue from here, but I’ll keep this thread updated.
Actually I just noticed that it is listed under that page, as “Capture”. However, that version is 1.3.0.
What is the best approach to find out what broke it? Which of the native API calls are not supported in Ionic View?
My way forward is trying out MediaCapture 1.3.0 to see if that works with Ionic View.
EDIT: I tried that out, but it produced the same error:
01-30 15:46:44.410 25604 25632 E AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
01-30 15:46:44.410 25604 25632 E AndroidRuntime: Process: com.ionic.viewapp, PID: 25604
01-30 15:46:44.410 25604 25632 E AndroidRuntime: Theme: themes:{}
01-30 15:46:44.410 25604 25632 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'org.apache.cordova.file.LocalFilesystemURL org.apache.cordova.file.FileUtils.filesystemURLforLocalPath(java.lang.String)' on a null object reference
01-30 15:46:44.410 25604 25632 E AndroidRuntime: at org.apache.cordova.mediacapture.Capture.createMediaFile(Capture.java:486)
01-30 15:46:44.410 25604 25632 E AndroidRuntime: at org.apache.cordova.mediacapture.Capture.onVideoActivityResult(Capture.java:445)
01-30 15:46:44.410 25604 25632 E AndroidRuntime: at org.apache.cordova.mediacapture.Capture$1.run(Capture.java:327)
01-30 15:46:44.410 25604 25632 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
01-30 15:46:44.410 25604 25632 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
01-30 15:46:44.410 25604 25632 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
What I’m curious about here is that the line numbers are the exact same… Which give me the suspicion that it is still using 1.4.x. How do I make sure I’m using the correct version?