Visual Studio 2017を15.8.1にアップグレードした後、Android SDKバージョン28(Android 9.0 Pをサポート))を使用すると、ビルドで問題が発生します。 XamarinベースのAndroid App C#プロジェクトで以下のエラーが発生します:
_LinkAssembliesNoShrink:
Creating "obj\\ObRelease\MonoAndroid90\link.flag" because "AlwaysCreate" was specified.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : Failed to read 'D:\MyAndroidApp\obj\ObRelease\MonoAndroid90\Android\assets\Mono.Android.dll' with debugging symbols. Retrying to load it without it. Error details are logged below. [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : Mono.Cecil.Cil.SymbolsNotMatchingException: Symbols were found but are not matching the Assembly [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader, Boolean throwIfSymbolsAreNotMaching) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleReader.CreateModule(Image image, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadModule(Disposable`1 stream, String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.ReadAssembly(String file) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : Failed to read 'D:\MyAndroidApp\obj\ObRelease\MonoAndroid90\Android\assets\System.dll' with debugging symbols. Retrying to load it without it. Error details are logged below. [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : Mono.Cecil.Cil.SymbolsNotMatchingException: Symbols were found but are not matching the Assembly [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader, Boolean throwIfSymbolsAreNotMaching) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleReader.CreateModule(Image image, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadModule(Disposable`1 stream, String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.ReadAssembly(String file) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : Failed to read 'D:\MyAndroidApp\obj\ObRelease\MonoAndroid90\Android\assets\System.Xml.dll' with debugging symbols. Retrying to load it without it. Error details are logged below. [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : Mono.Cecil.Cil.SymbolsNotMatchingException: Symbols were found but are not matching the Assembly [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader, Boolean throwIfSymbolsAreNotMaching) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleReader.CreateModule(Image image, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadModule(Disposable`1 stream, String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName, ReaderParameters parameters) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): warning : at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.ReadAssembly(String file) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: The "GenerateJavaStubs" task failed unexpectedly. [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object. [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.<>c.<ToJniNameFromAttributes>b__42_0(CustomAttribute a) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.ToJniNameFromAttributes(TypeDefinition type) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.ToJniName[T](T type, Func`2 decl, Func`2 name, Func`2 ns, Func`2 overrideName, Func`2 shouldUpdateName) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.ToJniName(TypeDefinition type, ExportParameterKind exportKind) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Java.Interop.Tools.TypeNameMappings.JavaNativeTypeManager.ToJniName(TypeDefinition type) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator.GetTypeMapping(Func`2 skipType, Func`2 key, Func`2 value) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator.WriteJavaToManaged(Stream output) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Xamarin.Android.Tasks.GenerateJavaStubs.UpdateWhenChanged(String path, Action`1 generator) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings(List`1 types) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Xamarin.Android.Tasks.GenerateJavaStubs.Run(DirectoryAssemblyResolver res) [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Xamarin.Android.Tasks.GenerateJavaStubs.Execute() [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [D:\MyAndroidApp.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2153,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [D:\MyAndroidApp.csproj]
Done Building Project "D:\MyAndroidApp.csproj" (default targets) -- FAILED.
手がかりOR解決策OR回避策はありますか?
PDATE: Visual Studio 2017を15.8.2に更新した後でも、問題は引き続き発生します。
Xamarin Androidプロジェクトの専門家ではありませんが、いくつかの提案をしたかっただけです。
ToJniNameFromAttributes
メソッドから発生しています。したがって、Java.interopパッケージへの参照を確認することをお勧めします。これが少し役立つことを願っています!
特定の回答を発行します:
以下は、この問題を具体的に解決するために行ったプロジェクト参照の変更です。答えを読んでいる人が問題/解決策を理解するのに役立つ可能性があるため、ここに追加するだけです。
元の参照は次のとおりです。
<Reference Include="Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Mono.Android.Export, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="mscorlib">
<Private>False</Private>
</Reference>
<Reference Include="System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
(ビルドが渡された)変更後の参照:
<Reference Include="Mono.Android" />
<Reference Include="Mono.Android.Export" />
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />