Getting InflateException ("Error inflating class") when inflating AppCompatImageView - xamarin.android

I'm working on a Xamarin app with an existing .aar lib. The lib was tested with a native Android demo application, and it works fine with the demo.
But when I invoke it through my Xamarin app, following InflateException was always thrown:
Android.Views.InflateException: 'Binary XML file line #1 in com.radaee.reader:layout/bar_cmd: Binary XML file line #1 in com.radaee.reader:layout/bar_cmd: Error inflating class androidx.appcompat.widget.AppCompatImageView'
Looks like some dependencies are missing from the Xamarin project, but I've added following dependencies from NuGet:
Xamarin.AndroidX.AppCompat
Xamarin.AndroidX.AppCompat.AppCompatResources
Xamarin.Android.Support.v4
Those are basically what the Android native application used.
And here is how the lib project basically using the AppCompatImageView:
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/btn_back"
android:layout_width="#dimen/toolbar_icons_size"
android:layout_height="#dimen/toolbar_icons_size"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
app:srcCompat="#drawable/ic_arrow_back"
android:tint="#color/red"/>
How does this issue come up, and how should I fix it?

Related

Can't build app on release mode Xamarin iOS

I keep getting this error when I try to run the app on release mode:
Severity Code Description Project File Line Suppression State Error
Can't resolve the reference 'System.Void
System.Security.Cryptography.DSACng::.ctor(System.Security.Cryptography.CngKey)',
referenced from the method 'T
Internal.Cryptography.Pal.Windows.PkcsPalWindows::GetPrivateKey(System.Security.Cryptography.X509Certificates.X509Certificate2,System.Boolean,System.Boolean)'
in 'System.Security.Cryptography.Cng, Version=4.3.3.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. LabelApp.iOS
I see on the internet that it is related to mailkit, however, I deleted all references to mailkit. On android, everything works fine and even on debug mode it works fine.
I already tried removing the references to mailkit and used older and newer versions of mailkit. I expected that the error would be resolved because this worked on another app I made in the past, but it didn't.
I fixed it. It seems that the problem was with a package called EPPlus which I used to export data to an excel file.

Build failed - Check imports - Dart Angular Tutorial - angular_tour_of_heroes - part 2

While following tutorail - Angular-dart tutorial - Tour of Heroes - part 2
with using IntelliJ IDEA in Windows 10 while using chrome, I got following error(s) -
[SEVERE] build_web_compilers|entrypoint on web/main.dart (cached):
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
import 'package:angular_app/app_component.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1
[SEVERE] Failed after 1.3s
Serving web on http://localhost:53323
I have checked multiple times & I have replaced all - 5 files - namely
lib/app_component.css, lib/app_component.dart, lib/app_component.html, lib/src/hero.dart & lib/src/mock_heroes.dart from Review the app structure but I am still getting the above mentioned error & -
I could not find any app_component.template.dart
Nor could found any instance of imported package:angular_app/app_component.css.shim.dart or shim using IntelliJ Find in Path (Ctrl+Shift+F)
I have tried to delete build and rebuild.
I have also re-installed dart 2.1.0 using windows package manager & changed the location of dart-sdk accordingly in IntelliJ IDEA Settings/Dart, as for brief period I was getting dart-sdk error, but that is fixed.
This my first time asking question on stacksoverflow, but I have checked similar questions, could not resolve that issue.
the most likely reason for that build failure is due to the stylesUrls files not being found. This could be because the name in that array doesn't match the name in the file system or is not the expected place in the file system.
To confirm, I started from scratch, downloaded the quickstart-master.zip to get the project structure.
And followed the steps all the way through the step you were stuck on.
The only time I was able to generate that error while following the steps is when I added thestyleUrls: ['app_component.css'], to app_component.dart prior to creating the file.
I got the same:
[SEVERE] build_web_compilers|entrypoint on test/app_test.dart.browser_test.dart:
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
import 'package:angular_app/app_components.css.shim.dart' as import0; from angular_app|lib/app_component.template.dart at 12:1
Once i created the css file, the error went away and everything worked fine.
I completed the entire step you were up to and my app was working fine.
I then did as you did and copied each file from the step and replaced my work with it, still worked.
So confirm my hunch, i changed the name of the css file, and received the same error.
regarding app_component.template.dart that file is auto generated by dart and can be found in your project under .dart_tool/build/generated/angular_app/lib
I had a very similar problem. I ran webdev build and then webdev serve and it fixed it right up.

MVVMCross PictureChooserTask load exception

I am creating an Android project with MVVMCross and Xamarin on Mac using Xamarin Studio. Everything has been going terrific until I got to needing to use the camera. I downloaded and installed the PictureChooserTask plugin. The issue I am having is after adding the dll's to the Android project and calling:
Cirrious.MvvmCross.Plugins.PictureChooser.PluginLoader.Instance.EnsureLoaded ();
I now can't run the application. It fails during startup with the following error:
Missing method AddOrOverwriteFrom in assembly .override/Cirrious.MvvmCross.Plugins.PictureChooser.Droid.dll
The solution that worked for me was to just manually register the singleton type using the following:
Mvx.RegisterType<IMvxPictureChooserTask, MvxPictureChooserTask> ();

Error preverifying class oauth.signpost.commonshttp.CommonsHttpOAuthConsumer

I am trying to preverify "signpost-commonshttp4-1.2.1.1.jar" file to use it in BlackBerry project
Here is the command im trying. Since it also needs "signpost-core-1.2.1.1.jar" to classpath which is already preverified.
C:\Eclipse_bb\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components\bin>
preverify.exe -classpath
"C:\Eclipse_bb\plugins\net.rim.ejde.componentpack5.0.0_5.
0.0.25\components\lib\net_rim_api.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\
rt.jar;C:\Eclipse_bb\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components
\bin\output\signpost-core-1.2.1.1.jar"
signpost-commonshttp4-1.2.1.1.jar
Here i have added classpath of net_rim_api.jar, rt.jar & signpost-core-1.2.1.1.jar
It throws below Error
Error preverifying class
oauth.signpost.commonshttp.CommonsHttpOAuthConsumer
VERIFIER ERROR oauth/signpost/commonshttp/CommonsHttpOAuthConsumer.wrap(Ljava/lang/Object;)Loauth/signpost/http/HttpRequest;:
Illegal type in constant pool
If you mean signpost, with source code hosted on github by kaeppler, then it appears to be a Java-SE library. BlackBerry is a Java-ME device, so you will need to find a Java-ME compliant library. The preverifier errors you are seeing are the first indication that the Java-SE code won't work on BlackBerry.

Mono For Android Hello World code throws AndroidManifest.xml error

I recently downloaded the trial version of Mono For Android. I tried running the Hello World tutorial. I receive the following error:
Tried to launch activity 'HelloMonoDroid.HelloMonoDroid/hellomonodroid.Activity1', but the device could not find it.
A common cause of this is manually adding an to your AndroidManifest.xml whose name does not match your Activity class.
Consider using the [Activity] attribute instead:
http://monodroid.net/Tutorials/Working_with_AndroidManifest.xml
I triple checked my code and didn't see any differences between it and the posted code in the tutorial. So I tried to create a new Mono For Android Project and ran it without modification. I named the Project Driver. Here is the error I received:
Tried to launch activity 'Driver.Driver/driver.Activity1', but the device could not find it.
A common cause of this is manually adding an to your AndroidManifest.xml whose name does not match your Activity class.
Consider using the [Activity] attribute instead:
http://monodroid.net/Tutorials/Working_with_AndroidManifest.xml
Notice it is the same as the original error with only the activity name changed. This is a simple solution. I am not creating a AndroidManifest.xml file manually. Is this a bug with the Mono For Android product?
Go to Tools->Options->Mono for Android and turn on adb logging.
This should write a log to your desktop that might give more details.
Aha, thanks I've found the issue. There is a place in that dialog (Tools->Options->Mono For Android) that sets the Android SDK path. After doing this the solution deploys and works with no trouble. I thought I told the installer where the SDK was, but apparently not. Its possible I got myself confused as I'm evaluating the Eclipse/Android SDK development environment in parrallel.

Resources