I have the problem that when I use a component from an existing Flex Library in my AIR project, the values that should be loaded from the appropriate locale .properties file are not loaded. The values are always null.
I am using Eclipse and have created an AIR project that refers to the existing Flex Library (of which I have the source code). When I use a component from that library it calls the following code:
var _resourceManager:IResourceManager = ResourceManager.getInstance();
var res:String = resourceManager.getString('resources', str, params);
"str" and "params" have valid values but res is always null.
The properties file is located within the assets directory of the Flex library. I am deducing that the properties file is not being loaded (for some reason). This Flex library works for other Flex projects so it has to be something about the way my project is set up.
I have my compiler settings set to: -locale en_US
Is there something special that AIR projects need to do to ensure that they can refer to properties files?
Any help greatly appreciated. Thanks,
Phil
I believe this is a compiler issue. It seems you have not set the locale folder in the compiler arguments.
Take a look at the LiveDocs page concerning resource compilation into Flex applications: http://livedocs.adobe.com/flex/3/html/l10n_3.html#158879
Related
Apologies if this sounds like a silly question. I'm not very experienced with how things are linked/bundled/assembled under the hood.
Before I begin, I'd like to say that I've tried reading documentation (such as https://learn.microsoft.com/en-us/xamarin/cross-platform/app-fundamentals/code-sharing) to find the answer, but was unable to.
If I have a Xamarin.Forms solution and I reference a .Net Standard project:
Question 1: Does all the code from this project get compiled and included into the app such that it may be disassembled later, or is it only code from classes that I actually make use of that gets included?
Bit more elaboration:
For example, I may have a School class that expects an IStudent (inject via DI), and a Student class that implements IStudent. Both of these exist in the .Net Standard project that I reference in the Xamarin.Forms project. However, if I only actually make use of the Student class (by registering it with type IStudent in my IoC container), will the code from School get included in the built app as well?
Question 2: If all the code from the project does get included, is there a way to forcefully specify which classes to include/exclude by way of some configuration setting, attributes, 3rd-party library, or something else?
As far as i know everything in the NETStandard project get compiled and shipped with the app.
If you want to remove unused code from compiled assemblies you have to use the linker.
To link everything, you have to select "Sdk and User Assemblies".
The linker tries to dont strip away mthods and fields you are using, but often is too aggressive (for example, methods referenced only by reflection will be stripped).
Luckily there are few methods where you can fine-tune the linker behaviour and make it work. Some link to elaborate on:
Linker in iOS and Android
https://learn.microsoft.com/en-us/xamarin/ios/deploy-test/linker
https://learn.microsoft.com/en-us/xamarin/android/deploy-test/linker
Official doc about the linker config:
https://learn.microsoft.com/en-us/xamarin/cross-platform/deploy-test/linker
Useful blogposts:
https://xamarinhelp.com/xamarin-linker/
https://medium.com/#harrycblum/reduce-your-xamarin-app-size-with-linking-26247edc87f6
I'm trying to use GmailSender in my Xamarin Android app. My main project is referencing the binding library, and the binding library has 2 jars - GmailSender 1.1.jar, and mail.jar.
the GmailSender 1.1.jar file is set as an EmbeddedJar in properties, and mail.jar is set as an EmbeddedReferenceJar in properties.
The following image depicts how my project is set up (higher res image: http://i.imgur.com/Xbq5uKa.png)
This is where I got GmailSender 1.1.jar: http://gmailsender.blogspot.ie/
This is where I got mail.jar (renamed from mail-6.0.0.jar) http://www.java2s.com/Code/Jar/m/Downloadmail600jar.htm
How can I get my Xamarin Android app to use GmailSender?
There is a note regarding that issue on Xamarin docs:
Note: Due to bug 6695, when referencing the Java Binding project
directly from a Xamarin.Android project, none of the namespaces,
classes, or other members of the Java Binding project will be visible
in the IDE when working on the Xamarin.Android project. This bug will
be fixed in a future version of Xamarin.Android.
You won't be able to see the bindings unless you reference the generated dll (this is a workaround)
You need to reference the library using the namespace of your binding library. By default, it is probably using "BindingLibrary1" as the root namespace, so try adding a using directive for that namespace.
I'm looking at using Sub-Applications within flex, to enable mutli-versioned compilation.
Specifically, I'm looking to have a Flex 4.x host app that loads Flex 3.6 sub-apps.
The docs state this is possible (and the purpose of sub-apps). However they specify this:
When compiling each of these types of applications, you should include
the MarshallingSupport class into the main application and
sub-applications. You do this with the includes compiler argument, as
the following example shows:
-includes=mx.managers.systemClasses.MarshallingSupport
However, from what I can tell, MarhsallingSupport wasn't included until the 4.x releases.
Looking at the mx.managers.systemClasses package for 3.5.0.12683 and 3.4.1.10084 shows no reference of MarshallingSupport (see svn here and here)
This is also true for 3.6a (download of SDK available, but can't find the source).
Am I missing something? How am I supposed to include this class in the 3.x sub-apps, when it's not available?
see http://help.adobe.com/en_US/enterpriseplatform/10.0/AEPDeveloperGuide/WS8cbf8723eeed7311-4cca458e1328d74a115-7fff.html
Like module bundles, there are no special compilation requirements. You can build the
application bundle SWF in any way that is convenient. Note, however,
that application bundles must include marshalling support.
This is automatic with Flex 3, but with Flex 4 you must force the inclusion
of the MarshallingSupport class in your SWF.
For Flex 4 this can be
done by referencing the MarshallingSupport class in your application
code (as in the previous example). You can also explicitly force
inclusion of the MarshallingSupport class on the mxmlc command line
using the following option:
-includes+=mx.managers.systemClasses.MarshallingSupport
In the simplest of Flex Projects, create an MXML Flex Module and then load it using the ModuleManager. No problem. Create an ActionScript class that extends Module and then configure your project to compile that into a Module. Load this new module instead. The project compiles, but crashes when running with the following error:
"Error: Could not find compiled resource bundle 'containers' for locale 'en_US'."
I believe the compiler is failing to compile the required class definitions into ActionScript only module, while it succeeds for the MXML module. I can see that my skeleton MXML module is slightly larger than my ActionScript module (66KB vs. 45KB).
How can I resolve this problem (if that is indeed the issue)?
A good approach in these sort of situations is to use -keep-generated-actionscript for two projects, one with the mxml approach, and one with the actionscript approach. You can then compare the code to see what might be missing from one project, but included in another.
Have you tried adding an explicit reference to [ResourceBundle("containers")] to your ActionScript project class? The mxmlc is different to the compc compiler in behaviour for many valid reasons.
I was having this same problem when compiling a library swc. I was able to fix it by adding the following section to the projects projectName-config.xml
<include-libraries append="true">
<library>${flexlib}/locale/{locale}/framework_rb.swc</library>
</include-libraries>
This forces the compiler to include the framework resource bundle for the specified locale.
for me the issue was finding out which project - in my case a library - and which class in this library caused this behavior (I needed to realize my last changes - no info from flashbuilder). Then applying the following attribute to the class:
[ResourceBundle("containers")]
public class IpChecker {
...
That did the trick.
How do I configure an ActionScript Project in Flex Builder 3 Pro so that I can compile an ActionScript class that is part of a package into a swf. For example, the class that I want to compile to swf is:
package utils {
import flash.display.Sprite;
public class Tool extends Sprite {
public function Tool() {
}
}
Take a directory structure like the following:
RootASProject
-RootASProject.mxml
-subASProject1
--subSubASProject1a
---IASModule.as
---ASModule.as
---ASModule.swf
--subSubASProject2
-utils
--ITool.as
--Tool.as
--Tool.fla
--Tool.swf
RootASProject is being produced by one developer, subASProject1 and subSubASProject1a by another developer, utils.Tool by yet another person. This directory structure enables each person to independently build modules and other resources, and quickly test the entire product. It is also important to note that these resources are loaded at runtime. So, class definitions must be fully qualified. For example, Tool.swf contains/defines "utils.Tool" not "Tool".
Developing with just the Flash IDE, this directory structure is not a problem. We create a Tool.fla and assign utils.Tool as it's Document Class then in the Flash IDE's Publish Setting, we set the class path to be NOT the current directory (.), but instead the RootASProject directory. If it were set to the current directory, the error would be: A file found in a source-path must have the same package structure '', as the definition's package, 'utils'. Tool Tool.as. We're familiar with this error message and so I recognize that the Flex IDE is by default looking in the current directory for a subfolder, utils, to match the packaged class.
In the Flex IDE, I can add the utils parent, RootASProject, as an additional source path, but I do not know how to stop flex from looking in the current directory first.
Using an ant build file, I can set the source path to RootASProject and the mxmlc is able to build utils/Tool.swf just fine. Apparently, it uses just the source paths passed to it, and does not automatically look for utils in the current directory.
I know the problem is resolved by using Flash or Ant. Ant is even preferred for larger and automatic builds; however, during rapid debugging I'd really enjoy being able to stay within the Flex IDE to step through code using its debugger.
Your compilation error is unrelated to its use as a document class. Your directory structure needs to match your package in your clas. The simple solution is to create a folder called "utils" and move your Tool.as into that folder.
What you refer to as a "document" class is the base class of the exported symbol. Assuming your project is an ActionScript project and the above class is marked as your Application, then it should work as expected.
If you are using Flex Builder 3 or better, simply create a new ActionScript project by going File > New > ActionScript Project and assign your ITool.as file as the main Application file in it.