Visual Studio 2015无法找到Android API级别 [英] Visual Studio 2015 unable to find Android API Level

查看:233
本文介绍了Visual Studio 2015无法找到Android API级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试创建Xamarin Forms项目时,VS为Android project给出了以下错误:

对象引用未设置为对象的实例.

输出为:

[I:sdk]:找到适用于Android \ AndroidSdkDirectory的HKCU \ SOFTWARE \ Novell \ Mono密钥:\ platform-tools(C:\ Program Files(x86)\ Android \ android-sdk)中包含adb.exe.

[I:sdk]:找到适用于Android \ AndroidNdkDirectory的密钥HKCU \ SOFTWARE \ Novell \ Mono:路径中包含ndk-stack.exe. (C:\ ProgramData \ Microsoft \ AndroidNDK \ android-ndk-r10e).

[I:sdk]:找到适用于Android \ JavaSdkDirectory的密钥HKCU \ SOFTWARE \ Novell \ Mono:\ bin(C:\ Program Files(x86)\ Java \ jdk1.7.0_51)中包含jarsigner.exe./p>

[I:Unknown]:找到了Android SDK. API级别:(无)

我认为问题是由于最后一行API levels: (none).此图显示了SDK Manager,并且我已经安装了API 23.

欢迎任何故障排除提示!

更新

如果我尝试构建现有项目,则会遇到以下异常:

"在'{0}'上未安装Android平台.请使用{1}{2}tools{2}{3}程序安装SDK平台."

无法确定API级别'-2147483648'的$(TargetFrameworkVersion). App1

这是输出:

1> C:\ Program Files(x86)\ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(569,2):错误XA5300:在'{0}'上未安装Android平台.请使用{1}{2}tools{2}{3}程序安装SDK平台."

1> C:\ Program Files(x86)\ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(569,2):错误XA5300:System.FormatException:索引(从零开始)必须大于或等于零且小于参数列表的大小.

1> C:\ Program Files(x86)\ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(569,2):错误XA5300:位于System.Text.StringBuilder.AppendFormatHelper(IFormatProvider提供程序,字符串格式,ParamsArray args)

1> C:\ Program Files(x86)\ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(569,2):错误XA5300:at System.String.FormatHelper(IFormatProvider provider,String format,ParamsArray args)

1> C:\ Program Files(x86)\ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(569,2):错误XA5300:位于System.String.Format(IFormatProvider提供程序,字符串格式,对象[] args)

1> C:\ Program Files(x86)\ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(569,2):错误XA5300:在Microsoft.Build.Framework.LazyFormattedBuildEventArgs.FormatString(CultureInfo文化,字符串未格式化,Object []参数)

1> C:\ Program Files(x86)\ MSBuild \ Xamarin \ Android \ Xamarin.Android.Common.targets(569,2):错误XA0000:无法确定API级别'-2147483648的$(TargetFrameworkVersion). '

有人知道什么是{0..3}占位符吗?

解决方案

仅安装最新的 Xamarin 解决了该问题.

我尝试使用Visual Studio安装程序安装SDKNDK,或升级Platform API,然后重新安装所有内容,但没有一个起作用.包括此答案.

When I'm trying to create Xamarin Forms project, VS gives me the following error for Android project:

Object reference not set to an instance of an object.

The output is:

[I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found: Path contains adb.exe in \platform-tools (C:\Program Files (x86)\Android\android-sdk).

[I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found: Path contains ndk-stack.exe in . (C:\ProgramData\Microsoft\AndroidNDK\android-ndk-r10e).

[I:sdk]: Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found: Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.7.0_51).

[I:Unknown]: Found Android SDK. API levels: (none)

I think the issue is because of the last line, API levels: (none). This picture shows SDK Manager, and that I have installed API 23.

Any troubleshooting tip is welcome!

UPDATE

If I try to build existing projects, I'll get the following exceptions:

"No Android platforms installed at '{0}'. Please install an SDK Platform with the {1}{2}tools{2}{3} program."

Could not determine $(TargetFrameworkVersion) for API level '-2147483648.' App1

And this is the output:

1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(569,2): error XA5300: "No Android platforms installed at '{0}'. Please install an SDK Platform with the {1}{2}tools{2}{3} program."

1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(569,2): error XA5300: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(569,2): error XA5300: at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)

1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(569,2): error XA5300: at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)

1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(569,2): error XA5300: at System.String.Format(IFormatProvider provider, String format, Object[] args)

1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(569,2): error XA5300: at Microsoft.Build.Framework.LazyFormattedBuildEventArgs.FormatString(CultureInfo culture, String unformatted, Object[] args)

1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(569,2): error XA0000: Could not determine $(TargetFrameworkVersion) for API level '-2147483648.'

Does anyone know what are {0..3} placeholders?

解决方案

Only installing latest Xamarin solved the problem.

I've tried installing SDK and NDK with Visual Studio installer, or upgrading Platform API, and reinstalling everything, and none of them worked. Including this answer.

这篇关于Visual Studio 2015无法找到Android API级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆