This--
import net.rim.device.api.ui.container.VerticalFieldManager;
public class FixedHeightVerticalFieldManager extends VerticalFieldManager
{
private int height;
public FixedHeightVerticalFieldManager(int height)
{
super();
this.height = height;
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(maxWidth, height);
setExtent(height);
}
}
--causes the emulator to hang with the runtime exception net.rim.device.api.ui.ScrollView not found. It seems to be caused by the call to setExtent, which is a method VerticalFieldManager inherited from Field, which is in the 4.6 API that the emulator is set up to use. Why? What does ScrollView have to do with anything?
net.rim.device.api.ui.ScrollView is not available in 4.6 API - that's the reason. So I suspect you're using the ScrollView somewhere in your code while you are trying to run on a 4.6 OS simulator.
Also what API version is used to build the project? Normally (if you'd use 4.6 API lib/JDE) you should have got this error at building step (versus in runtime).
UPDATE:
I really have no idea why this is related to setExtent().
I suspect most likely you compile using API 6. For API 6 the inheritance chain looks as Field > ScrollView > Manager > VerticalFieldManager, so when you compile a VerticalFieldManager it may use ScrollView. Maybe that's why you get the error on API 4.6 simulator. You can test this idea by trying to run your app on any OS 6.0 simulator. I believe it should not give this error.
P.S. I have not used BB Eclipse plugin much (once I tried, but then refused because of some issues), so I can't say where exactly to check the API version. However surely there must be a way to check that.
Related
Our Xamarin Android app relies heavily on some older components in MvvmCross 4.4.0 and so has not been updated to modern versions.
We used the guide found here to modernise just enough to get over the API 29/Android 10 hurdle:
https://blog.ostebaronen.dk/2020/08/old-mvvmcross-and-android-10.html
We're now at the API 31/Android 12 hurdle and, whilst everything builds and executes fine with API 31 when running on Android 11 and below, Android 12 is crashing.
The MainActivity is initialising with a null ViewModel because the LayoutInflater (already corrected for API 29) cannot retrieve the current binding context with MvxAndroidBindingContextHelpers.Current().
Nothing in the Android 12 behaviour changes guides gives an indication as to what is causing this change. We have also reviewed changes in modern versions of the MvvmCross.Binding source and can't see any obvious changes that correct this behaviour.
This is the code in LayoutInflater.cs where the problem first surfaces:
public override View? Inflate(int resource, ViewGroup? root, bool attachToRoot)
{
// Make sure our private factory is set since LayoutInflater > Honeycomb
// uses a private factory.
SetPrivateFactoryInternal();
// Save the old factory in case we are recursing because of an MvxAdapter etc.
IMvxLayoutInflaterHolderFactory? originalFactory = _bindingVisitor.Factory;
try
{
IMvxLayoutInflaterHolderFactory? factory = null;
// Get the current binding context
var currentBindingContext = MvxAndroidBindingContextHelpers.Current();
// currentBindingContext is null on Android 12, not on Android 11 and below
if (currentBindingContext != null)
{
factory = FactoryFactory?.Create(currentBindingContext.DataContext);
// Set the current factory used to generate bindings
if (factory != null)
_bindingVisitor.Factory = factory;
}
// Inflate the resource
var view = base.Inflate(resource, root, attachToRoot);
// Register bindings with clear key
if (currentBindingContext != null)
{
if (factory != null)
currentBindingContext.RegisterBindingsWithClearKey(view, factory.CreatedBindings);
}
return view;
}
finally
{
_bindingVisitor.Factory = originalFactory;
}
}
Any insight as to potential causes of the problem would be welcome, even if it's a concrete reason why MvvmCross 4.4.0 is simply no-longer viable on Android 12.
Thanks very much.
Update: We have now successfully updated to MvvmCross 5.0.1 and the problem still remains (which we expected). Our dependency is on MvvmCross.Droid.Shared, which is removed from newer versions. Can anybody recommend a guide on migrating away from MvvmCross.Droid.Shared please, as it doesn't appear to be mentioned in the upgrade guides other than to just remove it?
Update 2: Switching out the LayoutInflater for the one from MvvmCross 9.0.1 makes no difference. We've done this simply to rule that out. The issue feels like it related more to Binding.
The issue was not directly related to MvvmCross, but rather a change in Android 12 behaviour that prevented initialisation in a manner that meant ViewModel binding wasn't happening despite the rest of the code executing.
The resolution was to add some specific AndroidX initialisation lines to the AndroidManifest:
<provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup">
<meta-data android:name="androidx.lifecycle.ProcessLifecycleInitializer" android:value="androidx.startup" />
</provider>
...and to
Update Xamarin.GooglePlayServices NuGet packages
Add Xamarin.AndroidX NuGet packages
Increase the minSdkVersion from 19 to 21
I have a certain task where i want to pass a UIView to one of the SDK's in my iOS project.
Now, my project is a simple 2D game build in Unity 3d. I want to send the Panel in my Canvas to that SDK as UIView.
I am aware of iOS and Unity communication. It happens using as Char*.
I am not sure how should i access that GameObject Panel in my iOS code as UIView. I will be very thankful if i receive any help on this.
Above is one of solution that you can access from ios interface but before see this, read https://docs.unity3d.com/Manual/PluginsForIOS.html. it will help to understand how unity and native code can communicate.
iOS: test.mm
#import "Unity/UnityInterface.h"
...
...
-(void)SendMessage
{
UnitySendMessage("MessageGameCommunicator", "Receiver", [message UTF8String]);
}
Unity: Commnicator.cs, MessageGameCommunicator (GameObject name)
public class Commnicator : MonoBehaviour
{
public static void Receiver(string message)
{
// ...
// Do something.
}
}
After Unity interface get message from ios, you can implement whatever you want.
I have been going through different posts regarding Bit Code option introduced in XCode. As i am creating a project in unity trying to reduce the over the air build size. According to most of the bit code post related to unity they ending up disabling it. my questions are
If i enable the bit code for unity project i know the addition bit
code data will be stripped but does it will decrease the orignal size
of Over-the-air build as right now i have an estimate universal
Download size is 125 MB and i want it to be less then 100MB?
Can i disable the bit code for a specific framework but enable for
project?
Unity Version : 5.3.5f1t
XCode : 7.2
Thanks
As stated here
, bit code is specifically for App Store submission. And extra data will be stripped by App Store only. So I guess in all other cases like ad-hoc/OTA it will not reduce build size.
For your other question, you can use PostProcessing to change these settings.
Here is an example:
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.Collections;
using UnityEditor.iOS.Xcode;
using System.IO;
public class BL_BuildPostProcess
{
[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
if (buildTarget == BuildTarget.iOS)
{
string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
PBXProject proj = new PBXProject();
proj.ReadFromString(File.ReadAllText(projPath));
string target = proj.TargetGuidByName("Unity-iPhone");
proj.SetBuildProperty(target, "ENABLE_BITCODE", "false");
File.WriteAllText(projPath, proj.WriteToString());
}
}
}
Other references:
IL2CPP Build Size Optimizations
Bitcode Support In IOS & TvOS
hope it helps :)
I don't know what this error means:
Assert failed: Unsupported format for depth and stencil buffers...
I faced the same problem today when I was porting form cocos2d-x v3.4 to v3.14. There was some difference in appDelegate.
try this
in AppDelegate.h declare this method.
virtual void initGLContextAttrs();
in AppDelegate.cpp
void AppDelegate::initGLContextAttrs()
{
// set OpenGL context attributes: red,green,blue,alpha,depth,stencil
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
GLView::setGLContextAttrs(glContextAttrs);
}
// if you want to use the package manager to install more packages,
// don't modify or remove this function
static int register_all_packages()
{
return 0; //flag for packages manager
}
see if this resolves the issue. It did the trick for me.
It shows the issue is with the eaglview you are creating,can you please paste the appcontroller and appdelegate content here as the error comes by running the content in applicationdidfinishlaunching function placed in appcontroller.
and which Cocos2dx version you are using?
I am new to Blackberry development and Im trying to simple get a BrowserField working.
I get this errormessage:
Tried reinstalling JDE etc. etc. but the app always gets an error when I run it on the simulator..
Any ideas?
Here is my code:
package mypackage;
import net.rim.device.api.browser.field2.BrowserField;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
/**
* This class extends the UiApplication class, providing a graphical user interface.
*/
public class HelloBlackBerry extends UiApplication {
private MainScreen _screen;
private BrowserField _bf2;
HelloBlackBerry()
{
_bf2 = new BrowserField();
_screen = new MainScreen();
_screen.add(_bf2);
pushScreen(_screen);
_bf2.requestContent("http://www.blackberry.com");
}
public static void main(String[] args)
{
HelloBlackBerry app = new HelloBlackBerry();
app.enterEventDispatcher();
}
}
I do not have a Blackberry device to test on yet.
Normally, enabling the Mobile Data System Connection Service (aka MDS-CS) would have solved this BUT the MDS-CS version supplied with JRE 7.0.0 (9930 simulator) is incorrect! The original post on BlackBerry's forums can be found here.
According to this post:
An incorrect version of MDS-CS simulator was included in 7.0. To correct it you can delete it and copy the version from 6.0.
Deleting the invalid MDS version from JRE 7.0.0 and replacing it with the one from JRE 6.0.0 fixed the BrowserField issue for me. Don't forget to close and rerun the simulator and before reruning the application.
Here is a link to my original answer.
I too am having the same Problem and i came to know that as its the Runtime Exception so i suggest you to please write it in try catch block it seems it will work..
Thanks.
I want to suggest your one other thing that please rightclick on your project in eclipse and click on debug as... and in that click on debug configuration... and in that go into Simulator... and in that menu Select Launch Mobile Data System Connection Service with simulator... and there click on Apply and Debug it will work.
Thanks.
I got the Browser screen from your code; The thing is:
Before open the application some times you have to open the Blackberry browser and check any link(For Ex: http://google.com) even though you connect the internet settings and then run your application.
public class StartUp extends UiApplication
{
public static void main(String[]ali)
{
StartUp start=new StartUp();
start.enterEventDispatcher();
}
public StartUp()
{
MainScreen screen = new MainScreen();
BrowserField browserField = new BrowserField();;
screen.add(browserField);
pushScreen(screen);
browserField.requestContent("http://www.google.com/news");
}
}
This is a issue in blackberry please take a look into this
http://btsc.webapps.blackberry.com/btsc/microsites/search.do?cmd=displayKC&docType=kc&externalId=KB25846&sliceId=1&docTypeID=DT_SUPPORTISSUE_1_1&dialogID=1895604766&stateId=0%200%201895610037