错误:链接文件资源失败。 Xamarin Android

发布于 2025-02-10 17:14:52 字数 2089 浏览 3 评论 0原文

用Androidx迁移我的Xamarin Android应用程序后。这个错误即将到来。

错误:失败的链接文件资源。 zzapp.android
错误:找不到drapableStartCompat。

错误:找不到drapableleftcompat。

这是我的第一个布局文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="horizontal">

<NumberPicker
        android:id="@+id/picker_year"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="20dp"
        android:layout_marginRight="20dp" >
</NumberPicker>
        
<NumberPicker
        android:id="@+id/picker_month"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="20dp"
        android:layout_marginRight="20dp">
</NumberPicker>

<NumberPicker
        android:id="@+id/picker_day"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        >
</NumberPicker>
 </LinearLayout>
</LinearLayout>

这是我的第二个布局文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="horizontal">

<NumberPicker
        android:id="@+id/number_picker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
</NumberPicker>
</LinearLayout>
</LinearLayout>


    

任何帮助将不胜感激。谢谢!

After Migrate my Xamarin Android app with AndroidX. This error is coming.

Error: failed linking file resources. ZZAPP.Android
Error: attribute drawableStartCompat not found.

Error: attribute drawableLeftCompat not found.

This is my 1st layout file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="horizontal">

<NumberPicker
        android:id="@+id/picker_year"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="20dp"
        android:layout_marginRight="20dp" >
</NumberPicker>
        
<NumberPicker
        android:id="@+id/picker_month"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="20dp"
        android:layout_marginRight="20dp">
</NumberPicker>

<NumberPicker
        android:id="@+id/picker_day"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        >
</NumberPicker>
 </LinearLayout>
</LinearLayout>

This is my 2nd layout file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="horizontal">

<NumberPicker
        android:id="@+id/number_picker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
</NumberPicker>
</LinearLayout>
</LinearLayout>


    

Any help is appreciated. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生生不灭 2025-02-17 17:14:52

首先,请添加XMLNS:app =“ http://schemas.android.com/apk/res-auto” in xml,例如

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"

:您仍然不起作用,您可以尝试更新材料包的版本。

更新

我对我的ptoject进行了测试:

  1. xamarin.androidx.appcompat.appcompatresources 1.3.1.1
  2. xamarin.forms 5.0.0.0.2291
  3. xamarin.google.google.android.android.material.android.material
  4. 1.4.0.0.0.2

At first, please add the xmlns:app="http://schemas.android.com/apk/res-auto" in to the xml, such as:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"

And then you can try again, if still not working, you can try to update the version of the material package.

Update

I had test on my ptoject:

  1. Xamarin.AndroidX.AppCompat.AppCompatResources 1.3.1.1
  2. Xamarin.Forms 5.0.0.2291
  3. Xamarin.Google.Android.Material 1.4.0.2
  4. Visual Studio 2022 17.3.0 proview 2.0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文