• 14
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

Are the androidx libraries available in Visual Studio's NuGet package manager?

My app is targeting Android P so I can use the androidx libraries in Android Studio but I can't find them in NuGet.

With Android Studio I can use:

<androidx.constraintlayout.widget.ConstraintLayout

but throws exception in Visual Studio:

02-09 21:31:59.970 I/MonoDroid( 8843): UNHANDLED EXCEPTION:
02-09 21:32:00.137 I/MonoDroid( 8843): Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class androidx.constraintlayout.widget.ConstraintLayout ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class androidx.constraintlayout.widget.ConstraintLayout ---> Java.Lang.ClassNotFoundException: Didn't find class "androidx.constraintlayout.widget.ConstraintLayout" on path: DexPathList[[zip file "/data/app/Keystore.Keystore-aaHeQkjsNRoUnkfPmnf7Tw==/base.apk"],nativeLibraryDirectories=[/data/app/Keystore.Keystore-aaHeQkjsNRoUnkfPmnf7Tw==/lib/x86, /data/app/Keystore.Keystore-aaHeQkjsNRoUnkfPmnf7Tw==/base.apk!/lib/x86, /system/lib]]
02-09 21:32:00.137 I/MonoDroid( 8843):    --- End of inner exception stack trace ---
02-09 21:32:00.137 I/MonoDroid( 8843):    --- End of inner exception stack trace ---
02-09 21:32:00.137 I/MonoDroid( 8843):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <8acc8089c2ed40d08469fbaa6710a44c>:0 
02-09 21:32:00.137 I/MonoDroid( 8843):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <8acc8089c2ed40d08469fbaa6710a44c>:0 
02-09 21:32:00.137 I/MonoDroid( 8843):   at Android.App.Activity.SetContentView (System.Int32 layoutResID) [0x00022] in <957bbfdfda4341e2939c881206c1140a>:0 
02-09 21:32:00.137 I/MonoDroid( 8843):   at Keystore.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00009] in H:\My Projects\Android\Samples\Keystore\MainActivity.cs:19 
02-09 21:32:00.137 I/MonoDroid( 8843):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <957bbfdfda4341e2939c881206c1140a>:0 
02-09 21:32:00.138 I/MonoDroid( 8843):   at (wrapper dynamic-method) System.Object.3(intptr,intptr,intptr)
02-09 21:32:00.138 I/MonoDroid( 8843):   --- End of managed Android.Views.InflateException stack trace ---
02-09 21:32:00.138 I/MonoDroid( 8843): android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
02-09 21:32:00.138 I/MonoDroid( 8843): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
02-09 21:32:00.138 I/MonoDroid( 8843): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.constraintlayout.widget.ConstraintLayout" on path: DexPathList[[zip file "/data/app/Keystore.Keystore-aaHeQkjsNRoUnkfPmnf7Tw==/base.apk"],nativeLibraryDirectories=[/data/app/Keystore.Keystore-aaHeQkjsNRoUnkfPmnf7Tw==/lib/x86, /data/app/Keystore.Keystore-aaHeQkjsNRoUnkfPmnf7Tw==/base.apk!/lib/x86, /system/lib]]
02-09 21:32:00.138 I/MonoDroid( 8843):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
02-09 21:32:00.138 I/MonoDroid( 8843):  at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
02-09 21:32:00.138 I/MonoDroid( 8843):  at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.view.LayoutInflater.createView(LayoutInflater.java:606)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
02-09 21:32:00.138 I/MonoDroid( 8843):  at md561c0eefc2ba1e38323457d81b00d3caf.MainActivity.n_onCreate(Native Method)
02-09 21:32:00.138 I/MonoDroid( 8843):  at md561c0eefc2ba1e38323457d81b00d3caf.MainActivity.onCreate(MainActivity.java:31)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.app.Activity.performCreate(Activity.java:7136)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.app.Activity.performCreate(Activity.java:7127)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
02-09 21:32:00.138 I/MonoDroid( 8843):  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
02-09 21:32:00.139 I/MonoDroid( 8843):  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
02-09 21:32:00.139 I/MonoDroid( 8843):  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
02-09 21:32:00.139 I/MonoDroid( 8843):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
02-09 21:32:00.139 I/MonoDroid( 8843):  at android.os.Handler.dispatchMessage(Handler.java:106)
02-09 21:32:00.139 I/MonoDroid( 8843):  at android.os.Looper.loop(Looper.java:193)
02-09 21:32:00.139 I/MonoDroid( 8843):  at android.app.ActivityThread.main(ActivityThread.java:6669)
02-09 21:32:00.139 I/MonoDroid( 8843):  at java.lang.reflect.Method.invoke(Native Method)
02-09 21:32:00.139 I/MonoDroid( 8843):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
02-09 21:32:00.139 I/MonoDroid( 8843):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

So is there a way to use the androidx libraries with Xamarin.Android?

The reason you cannot find it is because you must not have its NuGet

We need to add Xamarin.Android.Support.Constraint.Layout package to support ConstraintLayout in our Xamarin.Android project. So to add this package right click on

Packages > Add Packages. //MAC

References -> Manage NuGet Packages //Windows

Search for ConstraintLayout and add a package by accepting a licence.

And use the following namespace <android.support.constraint.ConstraintLayout> in XML

Update

In my knowledge <androidx.constraintlayout.widget.ConstraintLayout is unavailable in Mono.Droid and hence you might have to bind it to an AAR and then use that AAR to make a Xamarin Binding fix the issues that happen while making that binding and then use it into your Droid project as a .dll

  • 0
Reply Report
      • 1
    • I have its NuGet, version 1.1.2 and works but I wanted to know if we can use the androidx one. Also we have to right click on References -> Manage NuGet Packages...
    • I don't think that is available! I actually use a mac so for me its add packages! But you could bind its aar into xamarin if you have it!