xamarin 有没有一种方法可以修复错误:AMM0000当我尝试在Visual Studio上将Framework升级到Android 10.0 Q时

4si2a6ki  于 2023-10-14  发布在  Android
关注(0)|答案(1)|浏览(182)

我正在尝试用visual studio /mac/将应用程序升级到android 10上。
从SDK管理器->我下载Android SDK Platform 29。从项目选项的属性中,我将框架从9.0 Pie更改为10 Q
所以当我尝试构建应用程序时,我收到了以下错误:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3):
Error AMM0000: /Users/../obj/Debug/AndroidManifest.xml:24:18-86 
Error: (AMM0000) (appName)

其他连续错误包括:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): 
Error AMM0000:  Attribute application@appComponentFactory 
value=(androidx.core.app.CoreComponentFactory) 
from AndroidManifest.xml:24:18-86 (AMM0000) (WeatherApp.Android)

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): 
Error AMM0000:  is also present at AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory). (AMM0000) (AppName)

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): 
    Error AMM0000:  Suggestion: add 'tools:replace="android:appComponentFactory"' 
    to <application> element at AndroidManifest.xml:8:3-25:17 to override. 
    (AMM0000) (WeatherApp.Android)

每一个错误都会在这部分代码的xamarin.android.common.targets文件中发送给我:

<ManifestMerger
  ToolPath="$(JavaToolPath)"
  JavaOptions="$(JavaOptions)"
  ManifestMergerJarPath="$(AndroidManifestMergerJarPath)"
  AndroidManifest="$(IntermediateOutputPath)AndroidManifest.xml"
  OutputManifestFile="$(IntermediateOutputPath)android\AndroidManifest.xml"
  LibraryManifestFiles="@(ExtractedManifestDocuments)"
  ManifestPlaceholders="$(AndroidManifestPlaceholders)"/>

有没有一种方法可以修复错误。?
SDK Platform29 /Android 10.0 - Q

尝试构建应用程序后的错误。

我试图清理构建,我有这个错误:

Binary XML file line #1 in com.companyname.WeatherApp:layout/toolbar:
 Binary XML file line #1 in com.companyname.WeatherApp:layout/toolbar:
 Error inflating class android.support.v7.widget.Toolbar

所以错误就在这行代码上:

using System;

using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace WeatherApp.Droid
{
    [Activity(Label = "WeatherApp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
    }
}
ac1kyiln

ac1kyiln1#

当我遇到这个问题时,我创建了一个同名的新项目,并将AndroidManifest.xml文件传输到新项目。

相关问题