IllegalAccessError on Android Things - android-things

My app is throwing an IllegalAccessError after updating to the latest Android Things
preview. I have the following code to check for an OTA update:
UpdateManager manager = new UpdateManager();
manager.performUpdateNow(UpdateManager.POLICY_CHECKS_ONLY);
When I run this code I get the following error output:
java.lang.IllegalAccessError: Method 'void com.google.android.things.update.UpdateManager.<init>()' is inaccessible to class 'com.example.android.things.screensettings.MainActivity' (...)
This code was working before, why has this started happening after the update?

Starting in Preview 7, Android Things API services are not constructed as new
instances. They are instead accessed as singletons via getInstance() to be
more in line with Android API paradigms.
Be sure to update your app to use the Preview 7 SDK:
dependencies {
compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
}
Then modify your code to use getInstance() instead:
UpdateManager manager = UpdateManager.getInstance();
manager.performUpdateNow(UpdateManager.POLICY_CHECKS_ONLY);
Review the Android Things API reference
to verify if any of the other APIs you are calling have changed.

Related

HomeKit Delegate APIs not working inside iOS flutter plugin

I am developing a flutter plugin for accessing Apple HomeKit features inside my flutter app. The following project and code setup is done for iOS project inside flutter folder:
Project setup:
1. Enabled HomeKit in Capabilities
2. Added Privacy – HomeKit Usage Description Key in Info.plist
Code Setup inside plugin:
1. Created instance of HMHomeManager
2. Set the HMHomeManager delegate
3. Implemented delegate methods
Also, cross verified the access to HomeKit for my flutter app in the Settings.
Issue 1:
For the same set up, a native iOS application is running fine and homeManagerDidUpdateHomes delegate method is getting called immediately after accessing HomeKit Database which is properly providing Home information.
But, in flutter plugin, delegate method is not getting called and always home count is Zero.
Issue2:
I have written code to add new HomeKit Home inside iOS plugin and tried calling the method from flutter UI. Strangely the code inside addHome(withName: ) block is not executing but Home is getting created inside HomeKit database. This is confirmed by running Apple ‘Home’ app.
In this case also, homeManager(didAdd home: ) delegate method is not called.
Version details:
Xcode: 11.2, swift 4.2
Flutter: 1.14.6, Dart: 2.8.0
Does any other set up is required in flutter plugin to set HomeKit Delegate?
As an alternative approach, also tried using cupertino_ffi_generated 0.1.1 (https://pub.dev/packages/cupertino_ffi_generated) which is a recent package from flutter for accessing Apple APIs. (Even though it is directly mentioned: “Most Flutter developers should not use this package. It's almost always a better idea to write a Flutter plugin than use this package.” ).
But, flutter throwing an error ‘Target of URI doesn't exist:’
Version details:
Flutter: 1.14.6, Dart: 2.8.0
I was facing a similar problem. iOS swift delegate methods were not triggered. It appears that the methods must have been declared public.
Just replace
func addHome...
with
public func addHome...
Maybe it will helps someone...

Can't get HockeyApp working on iOS with Xamarin Forms

I try to use HockeyApp on a iOS project with xamarin forms.
It's working fine on android, but I can't get it working on iOS.
Here's my AppDelegate code for HockeyApp:
var manager = BITHockeyManager.SharedHockeyManager;
manager.Configure("----");
manager.CrashManager.Init();
manager.LogLevel = BITLogLevel.Verbose;
manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend;
manager.StartManager();
manager.Authenticator.AuthenticateInstallation();
if (BITHockeyManager.SharedHockeyManager.CrashManager.DidCrashInLastSession)
{
runInSafeMode = true;
Thread.Sleep(5000);
}
Then, later in my code I throw an NotYetImplementedException.
The exception is correctly catched and send to the server on android, but I can't get it working on iOS.
BITHockeyManager.SharedHockeyManager.CrashManager.DidCrashInLastSession is always false.
I also tried without the debugger attached as I read that the debugger catch exception before the SDK, still not working.
Any ideas ?
EDIT : Additional informations
I tried Visual Studio Mobile Center, working fine on android, same issue with iOS, HasCrashedInLastSessionAsync always to false
I moved the throw exception outside of the main method, just in case of, still the same problem, exception looks like not detected by the API
I disabled the debugging in addition of not attaching the debugger, I also tried to compile in Release, nothing new.
I removed the call to Init and AuthenticateInstallation, still the same problem.
Where do you put your Hockey Init code?
I got it working with global::Xamarin.Forms.Forms.Init(); after the Hockey Init in my FinishedLaunching method.
Something like this:
var manager = BITHockeyManager.SharedHockeyManager;
...
manager.StartManager();
global::Xamarin.Forms.Forms.Init();

$ngCordova BLE plugin is undefined on iOS

I am working on connecting my iOS 5c v9.3.2 to my arduino uno with the blefruit add on. I am working on an Ionic project with the most recent version of ionic and cordova installed. I tried installed ngCordova, and included the cordova-plugin-ble-central to my plugins. I injected $cordovaBLE as I saw a few other examples show, but it was just an empty object when I ran the following code within the controller: alert(JSON.stirngify($cordovaBLE)); I also tried that with ble but it did not show a message. I believe that ble is undefined and because of that, the $cordovaBLE could not properly create it's functions. Is anyone else having this issue or might be able to help?
I tried creating a new project in ionic and setting it up as I had above, and this time when I used the ble to call my functions and copied the code directly from it's readme.md, it worked. I was passing an object where I should have been passing a success callback.

IBM Worklight Application Center iOS unresponsive to touch events

After successfully building and deploying the IBMAppCenter project, when attempting to download the IBM Application Center on iOS devices, there is no response when clicking on the actual installer link. This occurs on both real devices and through the simulator. Android application seems to be working just fine. I've provided a picture here showing some of the errors messages that we're seeing when clicking on 'IBM App Center iOS', as well as provided a subset of them below (http://i.imgur.com/vLrhVjT.jpg):
Deprecated attempt to access property 'changedTouches' on a non-TouchEvent object.
Deprecated attempt to access property 'target' on a non-Event object.
TypeError: undefined is not an object (evaluating 'a.target.getAttribute')
...
Deprecated attempt to access property 'which' on a non-UIEvent object.
App Center Console version 6.2.0.00-20140613-0730
IBM Worklight Studio version 6.2.0.1
Any idea what may be causing this, and how we can correct it? Thanks!
Make sure you are using a recent iFix of Worklight 6.2.0.x containing required Dojo fixes in order to add support for iOS 8 (which you are likely attempting to use the app on).
You can review the following tech note for instructions on downloading and installing the iFix: http://www-01.ibm.com/support/docview.wss?uid=swg21684538

Running Haxe from iOS app – hxRunLibrary() error

For a client I've developed an iOS + Android app using Cordova (PhoneGap) for the user interface. Now, as an update to this app, I'm am attempting to add a game that was written in Haxe. Originally the game was written for the Flash target, but I've updated it to work with the C++ targets for Android and iOS.
On Android it was easy to integrate this with the Cordova app using activities (the Haxe part runs as a separate activity), but I am having some trouble achieving a similar result on iOS.
So far I have tried to include all hxcpp generated code in my project (in the same way that NME sets up the XCode project when you do "nme build ios"), and I'm calling hxRunLibrary() from my code when I want the game to run.
The problem is that hxRunLibrary() seems to want to create its own UIApplication instance, which fails with the following error, since my main app is already running an instance:
*** Assertion failure in void UIApplicationInstantiateSingleton(Class)(), /SourceCache/UIKit_Sim/UIKit-2380.17/UIApplication.m:2037
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'There can only be one UIApplication instance.'
I think it might have something to do with SDL, which Haxe uses for graphics. From what I understand SDL needs to run from the main function of the app, which created a conflict with Cocoa that also needs to run from the main function.
Is there any easy way around this? I've looked in the hxcpp sources, but been unable to find the UIApplication related code, or any entry code for SDL.
Perhaps someone could point me in the right direction. Thanks!
Well ,I have googled some information about Haxe . what i understood is that The Haxe will prouduce a completed application for you .that mean it include the main Function . That's why the error is happend .
And you can simulate the problem by invoke UIApplicationMain Function twice .
In my opinion , you have to remove the code about UIApplicationMain from the souce code file produced by Haxe.
cordova has the ability to be integrated as part of a bigger application
ran into the same issue.
http://devgirl.org/2012/11/15/embed-cordovaphonegap-in-your-native-ios-app/
this article will help
you dont actually create a new project instead you embed it in a webview via the ios webview and cordova acts a subview.

Resources