Xamarin Android MobileBarcodeScanner.Initialize(Application) not found - android

Help,
I am using Xamarin.Android And I already install Zxing.Net.Mobile 2.4.1
Why i cant using MobileBarcodeScanner.Initialize(Application)
is there any component i have to install?
See this SS

So for those who land here later, The short answer is there's an error in the ZXing.Net.Mobile project Readme. The call to ZXing.Mobile.MobileBarcodeScanner.Initialize(Application) should go in the main activity class for the Android project, in the OnCreate method, not in the method that instantiates the scanner object. It should follow the call to ZXing.Net.Mobile.Forms.Android.Platform.Init(). Otherwise you will get the object reference error.
As a side note, I think you'll want to ensure that both ZXing.Net.Mobile and ZXing.Net.Mobile.Forms packages are installed across all your Xamarin projects. Also, version 2.4.1 appears to be based on .NET Standard, whereas the earlier versions appear to be based on .NET Framework. I found this out when I tried to downgrade as suggested in an earlier comment.

You can use Zxing.Net.Mobile 2.3.1, I test it, it did not have this issue.

Related

Can not install MvvmCross 9.0.9 (.NET6) creating a new android project in VS2022

I'm trying to install MvvmCross 9.0.9 for a new beginner project, reading the steps for TipCalc tutorial and used the newest version of it (https://github.com/MvvmCross/MvvmCross-Samples/tree/master/TipCalc), which works fine. But if I try to install MvvmCross package for brand new project with NuGet it says this
or if I add the reference to XXX.Core it gives me:
Warning Project '..\XXX.Control.Core\XXX.Control.Core.csproj' targets 'net6.0'. It cannot be referenced by a project that targets 'MonoAndroid,Version=v12.0 .
For XXX.Core there is no problem installing MvvmCross. Can anyone tell how to set up a new project without this behavior? I don't know what exactly I could have overlooked.
First I created a new .Core project with .NET6 library class as in the tutorial mentioned and installed MvvmCross package, added ViewModels etc.. No problems here. Then added the .Droid Xamarin project (Blank App). Everything step by step. After getting error, I tried different target frameworks changed here and restarted VS and rebuild. Still same behavior.
Unfortunately I haven't been able to find much about it here and as a newcomer to MvvmCross/Xamarin I also have difficulties finding current examples or tutorials for the latest version, so I welcome any help.
Just as the message said, the MvvmCross 9.0.9 is support the .net6.0 not the .NetFramwokr and MonoAndroid which the xamarin.android used.
So if you want to use the MvvmCross nuget package in the Xamarin.Android project, you need to use the lower version which supports the .NetFramwokr and MonoAndroid. Such as the MvvmCross 8.0.2.
You can also try to migrate the xamarin.android project to the .net 6.0 according to this document about Migrating Xamarin.Android Applications to .NET 6. And then you can install the MvvmCross 9.0.9 in the migrated project.
In addition, you said:
No problems here. Then added the .Droid Xamarin project (Blank App). Everything step by step. After getting error, I tried different target frameworks changed here and restarted VS and rebuild
I can't understand what does the added the .Droid Xamarin project (Blank App) mean. But you can create a new .net core app which target framework is .net 6.0. Such as:
And then copy the code and file in your old project to this new project. After this, you can also use the MvvmCross 9.0.9 in it.

MediaRouter and Palette not compatible with NetStandard2.1

Please help!
I'm trying to run my IOS xamarin app and have the following Android error:
code
PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.5"
PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.8"
code
If I remove them then I receive this error that they are required when I run in Android.
What should I do?
Make sure that "Xamarin.AndroidX.MediaRouter" and "Xamarin.AndroidX.Palette" only exist in Nuget of Android. If these two libraries are not used, delete these two libraries in all directories.
According to the tips of these two libraries, you need to ensure that your Android version is 9.
If you are running an iOS app, you shouldn't get an Android message, unless you accidentally added that Nuget package to your iOS solution
Check all the Nuget of the solution
Go to those Android packages.
If you check the right panel, you should see that those packages only have a version in the Android project. You should remove them from your shared or iOS project without problem.

Use .so library in Android Studio 0.8.2

I tested All previously shown answers on stackoverflow more than once. None of them working.
I use Android Studio 0.8.2 with the latest Gradle Version.
I have libfourier.so. This is a native library made in .c.
I don't have any other files.
It has been used in a previous app and did work.
I need this library because it can perform fast fourier transform without the input being a power of 2.
Is this possible? If yes, how?
Currently I have put the libfourier.so in /libs/armeabi/libfourier.so
And I call it by using
static {
System.loadLibrary("fourier");
}
But I get an UnsatisfiedLinkException stating the library could not be found.
There is no real magic. Just put it in libs/armeabi/libfourier.so like every other library.
Everybody saying otherwise is wrong.
First of all, the library was immediately found on a real device. So emulators in Android Device Manager and Genymotion cannot find this libraries apparently. Or the application is not installed as *.apk.
For the diehards, it is certainly possible to install the apk-file. But for the lazy ones like me, a real device will do the trick.
Secondly, you have to make sure your package name corresponds in the native function in the native code with the call to the native function in the android code.
If you have in Android intec.ugent.be.MyClass.nativeMethod() than your native method should be named: Java_intec_ugent_be_MyClass_nativeMethod(..). This is the case if you do not use JNI_onLoad in your native library.
Of course you have than to rebuild the jni-package with ndk-build. And add the new so-file to libs/armeabi.
So I would advice if you work with NATIVE CODE/LIBRARY just use a REAL device to RUN TEST DEBUG (do not forget to enable debugging on the device)

Using provided scope with Android Studio and Gradle (0.5.8+ only)

Using provided scope stopped working in android studio 0.5.8 for java modules.
For example, my Java module uses some classes that are required from Android...(bad I know, but issue exists with any kind of provided lib). Project compiles and runs fine but IDE shows provided classes as red:
Everything worked fine before 0.5.8 of android studio.
Intellisense does not work anymore....I feel like a savage coding without autocompletion
Filed a bug, where you can see details of the gradle file https://code.google.com/p/android/issues/detail?id=69481&thanks=69481&ts=13996519231
I want to believe this is a common setup, has anyone run into this and come up with any solutions?

Eclipse ADT: Project name "appcompat_v7" being created after creating every new project

Well I want to highlight this and bring it all in this thread, as the rest of threads did not have a concluded answer, so before skipping into them here are the threads I referred to:
Adt doesn't create default hello world but command line does
[solved ]Eclipse behaving differently while creating new project/activity
ADT has been behaving a bit weird since past few days. I keep my SDK always updated so I frequently Run the SDK manager and download all the updates. recently I noticed that if I create a new android app project it is not creating a default MainActivity even if I check that box, it does not create a Activity under src and more to annoy me, I wasnt able to refactor anything, so I realized that I had to update my Eclipse as after reading few posts, but now when I create every new project it creates an annoying appcompat_v7 project with EVERY project, say I create two new projects it creates appcompat_v7_2....this is driving me crazy and the new project library is the appcompat_v7 project. This is becoming annoying and no idea whats going on here !!!! What should I do...please rescue me ! Thanks in advance ....A screenshot to annoy u guys too ... :)
***************Current Alternative, not a solution***********************
As of 12/5/2014 with ADT 23.0.2 I dont see this issue anymore.
I have waited for an acceptable solution on this issue (as of now there is none), but one of the SO members directed me to this post https://code.google.com/p/android/issues/detail?id=66975. What I am doing is described in one of the solutions below, but for people who have come to this post, the alternative is to delete that ugly project(if you have more than one) which has been created and add up this one(appcompat_v7) as a library. So if you create another project and appcomat_v7_2...comes up delete that and point your project to the appcompat_v7, do the same for other projects too. This is not recommended for some reason though, but it worked well for me till now without issues. If anyone hits up with a solution please post it here.
****************Current Alternative, not a solution*****************************
the folder appcompat_v7 doesnt get created if i use
minSdkVersion="14"
Seems like it is a eclipse bug. What you need to do is go to properties in the of the Android Project and in the Android Section. Add the library appcompat_v7 and remove the appcompat_v_7_2 (duplicate). Then you can remove the appcompat_v7_2 as a eclipse project. All errors fixed.
Just a workaround.
The appcompat project is a library to support android's older versions. The support library was introduced by Google recently - I donĀ“t know in which Android version.
But the point is, this project is only created when you create an Android project to cross Android platforms. I mean, when you select an old min API, e.g. API 8 (Froyo), but target recently versions, your project must have the support library.
Anyway, the creation of appcompat_v7 project is some issue that has to be better configured by the eclipse plugin maintainers. However you can elegantly turn over this issue by targeting newer APIs and including in the build path the support library. This is more elegant than the others because it is better to you focus in only one android version when building your application, and when it is done, you have an authentic version of your app that you can use as a mold to support other versions, either older or newers.

Categories

Resources