MissingManifestResourceException on Windows Phone 8.1 with .resx resources - windows-runtime

I'm developing a Windows Phone 8.1 app that also targets Android(Xamarin)
As ever I added my string resources(.resx) on a PCL and referenced them on my launcher project to use it on my views, this all works fine on WP 8.1 silverlight but on the WinRt when I configure the project to release and run it on a device, for some reason I always get a MissingManifestResourceException. I've tried every solution for this problem out there without any success.
Note that on the emulator everything works fine, when the solution configurator is set to Debug it also works on both device and emulator. The only combination here is device and Release.
The app source code is on Github.
I was able to create a simple project to replicate this issue, basically it is a WP 8.1 app and a PCL project with the embedded resources, Download Link
Anyone has any ideas?
EDIT: After making some more testing I tried running an old Windows 8.1 app that I've done with the same localisation model and the same issue appeared so it seams to be a tool issue and not a configuration issue, since the Windows 8.1 app is on the market and everything went fine back there.

Our team ran into a similar issue which was tracked down to the runtime and not the PCL, WinRT component, or application package. That is, the resources exist within the PCL assembly, within the application package resources.pri file, but just cannot be found at runtime.
There is an active Microsoft Connect report here:
https://connect.microsoft.com/VisualStudio/feedback/details/991028/issue-using-resx-files-on-winrt-apps-windows-phone-and-windows
Our workaround was for the WinRT component to inject into each generated Resources class of each referenced PCL our own derived ResourceManager which redirected the call to the WinRT ResourceLoader instead. I've written a blog post that describes that workaround:
http://blogs.msdn.com/b/philliphoff/archive/2014/11/19/missingmanifestresourceexception-when-using-portable-class-libraries-in-winrt.aspx

I got to the bottom of this today. While bundling the app package, resources in dependencies that are not for a language being used by the app are stripped out. To prevent this from happening, add the following assembly-level attribute to your application.
using System.Resources;
[assembly: NeutralResourcesLanguage("en")]

I had the same behaviour. Today I created a new PCL Library (with another name) and copied the resx file to this project. I modified all references and everything just works fine in my WinRt (Windows Store) App now!
There was the string 'resources' in the portable class library name. Perhaps this was the problem!

I am able to reproduce this issue launching DVD sample and unfortunately in my project. I have an WP Silverlight 8.1 project registering a Windows Runtime Component Background Task and both of them using a Portable Class Library sharing some common localized strings as resources (.resx), among other things. The exception is thrown from Background Task when calling any property to get strings on generated .Design.cs class (only Release + Device).
In order to fix this I tried, without success, to use directly ResourceManager and/or to add .resx files directly into the Background Task.
I ended-up porting needed strings to .resw files and use the new "WinRT preferred" way via Windows.ApplicationModel.Resources.ResourceLoader in the Background Task project.
Seems to me that ResourceManager is not compatible with Windows Runtime anymore in release.
This is not necessary an answer, but is better than nothing since I do not have 50 reputation points for a comment.

Related

Windows Phone 8.1 - DLL reference problems when using the camera

I'm trying to create a simple camera application according to the MSDN tutorial.
All I did was installing Visual Studio 2013 Update 3 and then created a new Visual C# \ Store-Apps \ Windows Phone-Apps \ Empty App Template and added the code to my MainPage.xaml.cs.
The first problem is, that it does not find the namespaces Microsoft.Xna.Framework.Media, System.IO.IsolatedStorage and Microsoft.Devices. According to the tutorial, I have to add the Xna DLL in the "Add references" .net Tab, but unfortunately, there is no .net tab. I only have the following categories:
-Assembly (All Assemblys are already references)
-Project
-Windows Phone 8.1 (only 5 DLLs, but different ones)
After a lot of searching, I found them in 'C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\MdilXapCompilev8.0\Framework', but there is no System.IO.IsolatedStorage DLL.
When I ommit this using directive, I end up getting an error because it does not know this.Dispatcher.
Am I missing something? Do I have to install anything else?
The problem is probably that the link you have provided concerns WP8.1 Silverlight and you might have chosen WP8.1 Runtime project. Those are different API's - XNA is not supported in RunTime, you also won't find Microsoft.Devices there.
If you want to create your Camera App for WP8.1 Silverlight encure that you have chosen (Windows Phone Silverlight) template. Otherwise, of course you can also write Camera App but with different API - you may take a look here,also you may find something useful here at blog.

VS2013 deploys Windows Phone app to emulator only after 'Rebuild Solution' command

Something weird happened to one of my C# Windows Phone 8 Silverlight projects.
It's a simple page with one TextBox I'm experimenting with, building a customized style for it. First I placed a TextBox on the PhoneApplicationPage, generated a style template for it using the 'Edit Template\Edit a Copy' command from the context menu in the designer. Now I'm changing some setters and property values in the style, but when I hit F5, an old version of my project is launched in the emulator - all my recent changes aren't taken into account. The latest changes are reflected in the launched app only after I issue the 'Rebuild Solution' command from the Build menu.
The XAML markup has no errors, and it seems all stuff is correct. Other WP8 projects are built and deployed to the emulator ok too. The problem does not depend on the selected emulator (WVGA 512Mb, 720p, etc). Restarting VS/emulator has no effect too.
What it can be and how to fix it?
Some more info. For any normal project I see this in the Output window when I hit F5 (the app full path was shorten to save space):
But for the problem project, the output log ends on the line '1> Xap packaging completed successfully' and the old version of the app is opened in the emulator immediately.
It seems, I have managed to find the reason of this strange issue. This can happen if the name of a WP app includes spaces! I noticed that if we create a new project and use the space character in its name, the spaces are replaced with the underscore characters on the phone (for instance, "WP Test App" is deployed under the name "WP_Test_App"). I also found this while searching for a solution of this problem:
App doesn't get updated then debugging - incrmental update not correctly working?
I played a little bit with the names of my project and solution, i.e. removed the spaces in them, and it helped to solve my puzzle.
BTW, as the author of the question under the above link states, this problem never occurred in the WP 7.1 SDK - it is specific only for the WP 8 SDK.

What does static library and dynamic link library mean to WP8?

When reading about WP8 C++ project template, I see
Windows Phone Empty Dynamic Link Library
A project for creating a native dynamic-link library for a Windows
Phone app.
Windows Phone Empty Static Library
A project for creating a native static library for a Windows Phone
app.
What are static library and dynamic link library mean to WP8?
Supposed I have my Windows library source (openssl for example), do I need to convert to WP8 static library to be consumed by WP8 apps?
Whether I use WP8 static or dynamic link library, I must wrap them in WP8 runtime component in order for my app to consume, am I right ?
At the basic level, static and dynamic libraries are the same as any other Windows environment (so see this other SO question for more clarification).
For a WP8 app you will either need to produce:
A XAML .NET/Windows Runtime hybrid app.
A DirectX C++/C project (usually a game).
For 1. you would need to wrap up either your static .lib or .dll in a WP8 Runtime component, for your .NET side to consume.
For 2. it looks like you end up building a traditional .exe. In that case you would link directly to your .lib or .dll in the normal way. (I not so familiar with this one, so may be missing some subtleties here).
In any case it's easier to link everything if you have all the source code in VS and reference the projects that build .lib or .dll you need, rather than the referencing the binaries themselves.
That way you can ensure all the code is built to target the correct runtime environment (targetting the Phone APIs, using the correct CPU architecture). Also VS should then automatically add all dependencies into your final XAP package.

Launch LibGDX project with Android Studio

I've used "setup UI" to generate my LibGDX game projects.
Then I've imported them into Android Studio . It didn't show any errors at first , but when I've tried to run the android project , it gave me strange errors like :
java: cannot find symbol
symbol: variable super
location: class com.yan.waterworld.MainActivity
Here is an image :
How can it be solved (or worked around) ?
Update:
Since Android Studio 0.8.0 it is now possible to run Java and Android modules. This will not work by following these instructions (Android studio is based on Intellij).
Gradle Configuration
Old:
They have forums and notice here: https://code.google.com/p/libgdx/wiki/AndroidStudio
Using libgdx with Android Studio
At Google I/O 2013, the Android tools
team released Android Studio, and IDE based on IntelliJ IDEA, focusing
on pure Android development.
Android Studio is sadly unfit for libgdx projects at this time, as it
only allows the creation of Android projects. Standard Java projects
are not supported, and it is unclear if this will ever become
available.
Libgdx's cross-platform nature does not lend itself well to
development with Android Studio. This should not be a big hindrance,
as libgdx projects don't benefit much from Android Studios
capabilities. E.g. the layout preview is irrelevant for libgdx
applications, as they don't use native Android UI widgets. The inline
documentation support for Android APIs is also not needed for libgdx
applications.
However, we'll try to make developing libgdx applications with the new
Android Gradle build system possible in the near future.
If you must use Android Studio, check out this thread on the forums.
Alternatively you can use Intellij IDEA with libgdx, potentially with
Maven.
Creating games in gdx works perfectly fine in Android Studio. The best way to create a project for Android Studio is through gdx-setup. Please go to the following article
http://www.todroid.com/android-gdx-game-creation-part-i-setting-up-up-android-studio-for-creating-games/
It explains my experience in using the gdx-setup application, how to run it on the PC platform and steps for importing the gradle project and building a project in gradle.
When you have finished the article, hopefully you will have a fully working sample game template in which you can start building your game.
I tried to use a similiar method used for native libraries for now.
Last night, I was able to run examples; as a scratch project in Android Studio and wrote a quick guideline
Hope it helps you as well, but I am still learning so sorry in advance for any missing info or mistakes ;)
Here's the link.. http://bgnstudio.wordpress.com
I tried to use this way in detail:
create a new project in Android Studio.
From the libgdx nightly build, get;
Libgdx.so files within the armeabi/armeabi-v7a folders as needed.
Gdx.jar and gdx-source.jar
Gdx-backend-android.jar
Create lib and libs directories under project folder .
Copy armeabi* folders , gdx.jar and gdx-source.jar files under the “lib” directory.
Also copy the gdx-backend-android.jar into the “libs” directory.
*
In project tree; add gdx.jar and gdx-backend-android.jar as library.
In library settings, add gdx-source.jar under gdx.jar; Then open
module settings and add these libraries as dependencies. And check
them for compile.
Archive the armeabi folders together with parent directory to zip files and rename extension from zip to jar.
armeabi.jar : “/lib/armeabi/libgdx.so”
armeabi-v7a.jar :“/lib/armeabi-v7a/libgdx.so”
And move these jar files under “libs” directory.
Final apperance of the folders will be like this:
|-lib
|---gdx.jar
|---gdx-sorces.jar (added as source library of gdx.jar in library settings)
|-libs
|--- armeabi.jar
|--- armeabi-v7a.jar
|--- gdx-backend-android.jar
Now modify build.gradle file as well:
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile files('lib/gdx.jar')
compile files('libs/gdx-backend-android.jar')
compile fileTree(dir: 'libs' , include:'*.jar')
}
Have you tried IntelliJ 13? Download it here . This new version covers most of the function of Android Studio, but still it can make Java Project. Take a look at this article
This EAP build includes all of the new features of Android Studio except for the new project wizard and the AppEngine cloud endpoints integration. These latter features will also appear in our EAP builds in the coming weeks.
take a look at libdgx documentation:
https://code.google.com/p/libgdx/wiki/IntelliJIDEALibgdx
mark the Advanced->IDEA checkbox at libgdx project setup tool, create the project and import it from android studio(you will need add the assets folder to desktop launcher or maybe somethings like this), it works for me.

Unable to load dll in Console or Web API project

I'm experiencing a rather strange problem.
I'm trying to interface with a Wacom signature pad, and would like to build a web service wrapper for the pad's API so that I can capture a signature on a website.
The signature pad requires two dll's to work: STUTablet.dll and STUTabletCore.dll.
I have a class library that references STUTablet.dll. Both dll files are in the class library's bin directory.
If I reference my class library from a Windows Forms application, I am able to call methods that call STUTablet.dll. However, if I reference my class library from a console application or an MVC application, an exception is thrown.
The exception is as follows: Unable to load DLL 'STUTabletCore.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E).
I have tried adding the same references that a default Windows Forms application has to my Console application, but to no avail.
Does anybody have any idea as to why STUTablet.dll is unable to load STUTabletCore.dll? There has to be some kind of dependency that I'm not fulfilling.
Thanks,
Francis :)
I had similar issues but eventually got help from Wacom UK support team and managed to get
a web based application to work on IE only with ActiveX.
Try
http://gsdt.wacom.eu/download/Signature-SDK.xml
Choose either 32 or 64 bit Signature SDK installer, plenty of SDK examples