Unable to use a native android plugin for Unity - android

I wish to use this native plugin for Android devices via Unity.
For some reason the plugin is just now working. When I run it on a real device the game crashes. I am using Unity 5.5.2f1 personal, my phone is Samsung Edge 6 with Marshmallow api.
I have placed the jar file inside Assest/Plugins/Android. I can't figure out what is the cause for this error. Do you know what is wrong here?
This is part of my code:
private AndroidJavaObject plugin;
void Start ()
{
plugin = new AndroidJavaClass("jp.kshoji.unity.sensor.UnitySensorPlugin").CallStatic<AndroidJavaObject>("getInstance");
//Init the ambienttemperature sensor
if (plugin != null)
{
plugin.Call("startSensorListening", "ambienttemperature");
}
}

Related

Xamarin iOS Crash on Android

We are use Xamarin forms local notifications on our app. with the below line in the code it causes the app the crash
UNUserNotificationCenter.Current.RemovePendingNotificationRequests(requests);
even tho the line should only be run on iOS devices. this is done with the following;
`
if (Device.RuntimePlatform == "Android")
{
}
else
{
UNUserNotificationCenter.Current.RemovePendingNotificationRequests(requests);
}
`
the below error is given with the UNUserNotificationsCenter in the code
System.IO.FileNotFoundException: Could not load file or assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' or one of its dependencies.
anyone any ideas??
We have tried completely reimplementing the local notifications, clean and clearing bin/obj. updated both machine and vs to the latest version, updated frameworks.
built on VS Mac 2022 17.3.6
android framework 13.0.0.0

Unity Firebase is not initializing on builds

This is the exact same problem presented in this question: Unity Firebase is not initializing on Android
But the solution to that one doesn't work for me because the code is different.
When I run the app in Unity, Firebase is initialized correctly, but when I build the app, for Android or PC, it doesn't initialize.
I write my code from this tutorial: https://www.youtube.com/watch?v=A6du3DUTIPI
using System;
using System.Collections;
using System.Collections.Generic;
using Firebase;
using Firebase.Analytics;
using Firebase.Extensions;
using UnityEngine;
using UnityEngine.Events;
public class FirebaseInit : MonoBehaviour
{
public UnityEvent OnFirebaseInitialized = new UnityEvent();
private void Start()
{
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
{
FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
if (task.Exception != null)
{
Debug.LogError($"Error al inicializar Firebase con {task.Exception}");
return;
}
OnFirebaseInitialized.Invoke();
});
}
}
I have Unity 2019.4.4f1 and the latest Firebase SDK
I found a solution, but without fixing the actual problem.
I installed the Unity Editor using the offline installation, so it appears that this method doesn't download all the needed Android dependencies, because I tried installing again the Editor, but through the Unity Hub this time and the problem disappeared.

App crashes on Launch when made as system application

I developed an application that uses DJI SDK. When installed as an system application it crashes on Launch because its not able to load the libraries. It works fine when installed as normal application.
Steps followed to make system application
1)Rooted the device
2)Copied the .apk file to system/app directory
3)Rebooted the device
4)App was installed as default application but crashed on Launch
After commenting out the following line related to DJI SDK and followed the same steps as above. It worked fine as system app.
Helper.install(context);
The implementation of Helper class which is in DJI SDK is as below:
public static void install(Application app) {
Object var1 = null;
try {
System.loadLibrary("DexHelper_sdk");
if (PPATH != null) {
System.load(PPATH);
}
} catch (Error var3) {
;
}
String app_dataDir = app.getApplicationInfo().dataDir;
DexInstall.install(app, new File(app_dataDir + "/.cache_sdk/sdkclasses.jar"));
}
As far as my understanding the crash is because the system is failing to load the libraries.
My gradle looks similar as in the following link:
https://github.com/dji-sdk/Mobile-SDK-Android/blob/master/Sample%20Code/app/build.gradle
this issue has been fixed since 4.6 version of Android MSDK, pls try to update to the later version, right now the 4.7.1 has been released.

StripeModule failing for android React Native project

We have a project using Tipsi Stripe React module, when trying to build for Android I get the following error message: Native Module StripeModule tried to override StripeModule for module name StripeModule.
The error message does not make sense to me and I don't really know where to begin looking since i'm fairly new to mobile and React Native development.
Building for iOS works fine.
I have the same problem, i've tried adding
#Override
public boolean canOverrideExistingModule() {
return true;
}
to: /tipsi-stripe/android/src/main/java/com/gettipsi/stripe/StripeModule.java based on what i found here How to set canOverrideExistingModule=true.
It compiles, but I haven't tested if it keeps working, if it works i'll fork tipsi-stripe and create a PR later

Launching android emulator using specflow

I'm trying to use specflow to create automated testing for a Xamarin project in Visual Studio 2017. I've created a project which uses Nunit and specflow and created a feature file. I've seen it's possible to start a iPhone and do some automated testing, but I'm having problems on how to do this with android. I've read this BDD Test with xamarin where, as I understand, I should add this:
public static IApp StartApp(Platform platform, string simulator)
{
if (platform == Platform.Android)
{
return ConfigureApp
.Android
.StartApp();
}
return ConfigureApp
.iOS
.StartApp();
}
However I cannot figure out how this will help me launch the simulator, and what I should pass as the string to start an android simulator.

Categories

Resources