Writing an Android Wear Watchface, having errors in Wallpaperservice.java - wear-os

I'm totally new in the developer world, i started coding just 2 days ago, but until now everything went well.
Now i'm trying to make an android watchface and i'm trying to display just a basic bitmap on the smartwatch (using emulator)
The problem is that my watchface just crashes and the logcat says this:
06-29 17:35:58.182 5594-5594/wear.trombettonj.prova2 E/AndroidRuntime: FATAL EXCEPTION: main
Process: wear.trombettonj.prova2, PID: 5594
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:658)
at wear.trombettonj.prova2.AnalogWatchface$Engine.onSurfaceChanged(AnalogWatchface.java:126)
at android.service.wallpaper.WallpaperService$Engine.updateSurface(WallpaperService.java:770)
at android.service.wallpaper.WallpaperService$Engine.attach(WallpaperService.java:878)
at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:1165)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5974)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)
I tried fixing those errors and for example if i click on WallpaperService.java:770 it brings me to this file.
This file i assume is a primitive java library since it has not be created by me, and this file is FULL of errors "cannot resolve symbol 'PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS (example)'"
What is the problem here?

The important parts of the stack trace are:
Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
and
at wear.trombettonj.prova2.AnalogWatchface$Engine.onSurfaceChanged(AnalogWatchface.java:126)
meaning that at line 126 of your AnalogWatchface class, your're calling getWidth() on a null Bitmap object. It's nothing to do with WallpaperService per se.

Related

il2cpp file not available

I developed an iOS game in Unity editor which is also playable in Unity editor and I did Build&Run the game in iOS (Xcode). The build is succeed but the game does not work properly. That is why I decided to debug my function and then I got the following errors in Xcode (NOT IN UNITY):
NullReferenceException: A null value
was found where an object instance was
required. at
BallScript.MobileControl () [0x00000]
in :0
(Filename:
currently not available on il2cpp
Line: -1)
What is the reason to cause those errors and what can I do against them?
This means the code in the MobileControl method in the BallScript class is trying to use a null value somewhere. I'd recommend debugging the code to better understand what is happening. You need to be using Unity 2018.2 or later to debug C# code on iOS. You can see directions about how to do that here: https://docs.unity3d.com/Manual/ManagedCodeDebugging.html
Note that the (Filename: currently not available on il2cpp Line: -1) is benign. It is unrelated to the specific error in this case, and you can ignore it.

Windows Phone crashes in Release

I have made a Windows Phone application with Xamarin and Mvvmcross. When debugging the application it works perfectly. So the application was uploaded to the app store. but when the application got downloaded and run from the store it shut down immidiately after the icon gets clicked. So now i found out that the application does not work when running it on a device in release mode. (on a emulator it works fine).
First i got this exception
Error 1 Error : DEP6810 : MdilXapCompile.exe failed with error code 1004. See log file '~project.WinPhone\obj\Release\MDIL\MDILXapCompileLog.txt' for more details.
in this file there was an error
Compile filter argument specified non-existent file: ~project.WinPhone\obj\Release\MSIL\nl-NL\project.resources.dll
Invalid argument
This error made it unable to deploy the application to the device in release mode. I still have no idea why i got this error and how i am supposed to solve it. But i found a form of workaround by creating a 'nl-NL' map in the MSIL and adding the resource.dll to it. This made it able to deploy the application.
But when deploying the application in this state it crashed immediately. with the native debugger i could get it to break. it gave me this exception
Unhandled exception at 0x775E062F (COMBASE.DLL) in project.WinPhone.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x04F80AB8, 0x00000006).
Clicking on the Disassembly it had it's pointer on this line
77808534 bl SignalStartWerSvc (777FED78h)
It probably has something to do with my localizedresources, where i define some .resx files for filling the app with text. I did find out that this is causing me some problem with WP but i am not sure what i could do against it, i cannot use .resw files as have been suggested.
Has anyone ever had this sort of issue before and does anyone know how to solve it? It is keeping me from placing a working application on the app store, which is really frustrating.
Thank you in advance

Visual Studio 2013 crashes consistently when typing in an object/collection initiazlier?

Has anyone else ever seen this happen? I've had Visual Studio crash over and over again when typing in an object initializer: https://msdn.microsoft.com/en-us/library/bb384062.aspx
I suspect it's some kind of Intellisense bug, since it seems to occur only when the space or period key is pressed. I'm really curious what's triggering the sudden and reproducible crash and if there's any patches or workaround to prevent it from occurring.
The image shows where the cursor is when typing within the first set of brackets. This code appears in a method, which implements an interface member for the class.
This appears to have been caused by the "HideShow Comments" extension. I'm still not sure why it occurs, but disabling the plugin stops the crash from occurring and re-enabling the extension causes the crash to occur again. This must be a problem with Visual Studio itself, since it's the only common denominator in all these extension-related crashes.
I attached a debugger and caught the following error:
An unhandled exception of type 'System.NullReferenceException'
occurred in HideShow.Implementation. Additional information: Object
reference not set to an instance of an object.

Access violation writing location with openSceneGraph

Im setting up oculus rift with openSceneGraph(osgOculusViewer) but, the program stop work in this line: viewer.apply(oculusViewConfig).
When i run the debug the error message is: "Unhandled exception at 0x00007ffc20cd8030 (ot13-OpenThreadsd.dll) in OsgOculusViewer.exe: 0xC0000005: Access violation writing location 0x00000000cdcd0010."
Dont know what is the problem, if i coment this line the viewer oppen and shows the model.
My current directory is the desktop, can that be a problem? Can be some defenitions of the visual studio?
Thanks
You may validate viewer and oculusViewConfig objects. I suppose you must be invoking some functions over viewer object to render, most likely viewer object may not be problem.

"Invalid Binding Handle" while debugging

I've assembled my new PC yesterday, and I've decided to give Windows 8 a try. However, today, during the debugging of moderate Qt application, debugger yielded "Invalid Binding Handle" error message on a pretty simple line (it was line that is auto-generated by Qt's moc.exe:
// QWebView *view (...)
view->setUrl(QUrl(QString::fromUtf8("about:blank")));
// Failing in setUrl call, not in QUrl constructor, or in fromUtf8 function.
However, running this application without debugger works just fine, both in Release and Debug versions.
I've got some clues on the internet to enable Terminal Services, but it seems that there is no such service in Windows 8.
Does anybody have any clue what should I check?
Edit
Moving the widget into other application yielded no error, so apparently, widget (which is pretty small - just QWebView and QProgressBar) is fine. But, when I show this widget in my main function:
QApplication app(argc, argv);
MyWidget w;
w.show();
return app.exec();
it is still failing with the same error. Examining call stack (which is not very helpful when error appear) and stepping into function calls, I've tracked error down to retval = HeapFree(_crtheap, 0, pBlock); in function _free_base, in file free.c And it seems that function is called from dbgdel.cpp, function _free_dbg( pUserData, pHead->nBlockUse ); and it is called from unlock() function.
Attaching the debugger to already active process is still yielding the same error.
I am linking a lot of 3rd party libraries here, so I will try without them, as I'm run out of ideas...
Edit 2:
If I pass this exception to the program, it seems to be running fine.
Edit 3
Commenting setUrl line raises the same exception somewhere in QWebKit, where strdup function is called...
Well, this was easy, but it took me two months to solve (while ignoring the error in the meantime).
This was not an unhandled exception - this was handled exception, and stepping into assembly code and watching the stack frame told me that this exception was handled.
Then I remembered that I've set debugger to break when all C++ and Win32 exceptions are raised. Resetting the debugger settings removed the issue.

Resources