当我尝试在 Visual Studio 上将框架升级到 Android 10.0 Q 时,有没有办法修复错误:AMM0000

问题描述 投票:0回答:1

我正在尝试使用 Visual Studio /mac/ 升级应用程序以在 Android 10 上运行。

从 SDK Manager -> 我下载 Android SDK Platform29。 从项目选项的属性中,我将框架从 9.0 Pie 更改为 10Q

因此,当我尝试构建应用程序时,我收到此错误:

/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 平台29 /Android 10.0 - 问

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

我尝试清理构建,但出现此错误:

 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());
        }
    }
}
android macos visual-studio xamarin sdk
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.