C# monodroid-默认新未触及模板项目无法在android emulator中运行
我最近用VisualStudio2010 Professional安装了monodroid和附加组件。在新项目中,它似乎有部分编码,而且它似乎不是一个有效的示例代码。通过使用菜单中的“构建解决方案”,它可以很好地编译,但在android仿真器中不起作用。我期待一个只有文件结构的空白项目,但它似乎给了我一个不完整的示例项目。visual studio 2010 pro和monodevelop都会出现这种情况 是否存在仅具有文件结构的空白项目?如果是,我在哪里可以访问它们? 如果假设这是一个空白模板,那么为什么会有一些看起来像按钮计数器的代码呢 谢谢 乔恩C# monodroid-默认新未触及模板项目无法在android emulator中运行,c#,android,monodevelop,xamarin.android,C#,Android,Monodevelop,Xamarin.android,我最近用VisualStudio2010 Professional安装了monodroid和附加组件。在新项目中,它似乎有部分编码,而且它似乎不是一个有效的示例代码。通过使用菜单中的“构建解决方案”,它可以很好地编译,但在android仿真器中不起作用。我期待一个只有文件结构的空白项目,但它似乎给了我一个不完整的示例项目。visual studio 2010 pro和monodevelop都会出现这种情况 是否存在仅具有文件结构的空白项目?如果是,我在哪里可以访问它们? 如果假设这是一个空白模板
新项目/未触及项目的activity.cs中的代码
使用系统;
使用Android.App;
使用Android.Content;
使用Android.Runtime;
使用Android.Views;
使用Android.Widget;
使用Android.OS;
名称空间helloworld_a3
{
[活动(Label=“helloworld_a3”,MainLauncher=true,Icon=“@drawable/Icon”)]
公共课堂活动1:活动
{
整数计数=1;
创建时受保护的覆盖无效(捆绑包)
{
base.OnCreate(bundle);
//从“主”布局资源设置视图
SetContentView(Resource.Layout.Main);
//从布局资源中获取我们的按钮,
//并在其上附加一个事件
Button Button=FindViewById(Resource.Id.MyButton);
button.Click+=delegate{button.Text=string.Format(“{0}clicks!”,count++);};
}
}
}
尝试在android emulator上运行后的输出
打包应用程序。。
Microsoft(R)生成引擎版本4.0.30319.1
[Microsoft.NET Framework,版本4.0.30319.239]
版权所有(C)微软公司2007。版权所有。
构建开始于2011年12月22日下午3:27:28。
节点1上的项目“C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\helloworld-a3.csproj”(SignAndroidPackage目标)。
_GenerateAndroidAssetsDir:
正在跳过目标“_GenerateAndroidAssetsDir”,因为它没有输出。
_GenerateAndroidResourceDir:
正在将文件从“Resources\Layout\Main.axml”复制到“C:\Users\jon\Documents\visualstudio 2010\Projects\helloworld-a3\helloworld-a3\obj\Debug\res\Layout\Main.axml”。
_ResolveMonoAndroidDS:
正在寻找Android SDK。。
找到HKCU\SOFTWARE\Xamarin\MonoAndroid\PrivateAndroidSdkPath键:
路径包含\platform tools(C:\Users\jon\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\android sdk窗口)中的adb.exe。
正在寻找Java6SDK。。
找到HKLM\SOFTWARE\JavaSoft\Java开发工具包\CurrentVersion键。
找到HKLM\SOFTWARE\JavaSoft\Java开发工具包\1.6\JavaHome键:
路径包含\bin(C:\Program Files(x86)\Java\jdk1.6.0\U 27)中的jarsigner.exe。
MonoAndroid工具:C:\ProgramFiles(x86)\MSBuild\Novell\
MonoAndroid框架:C:\ProgramFiles(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v2.2\;C:\ProgramFiles(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\
Android SDK:C:\Users\jon\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\Android SDK windows\
Java SDK:C:\Program Files(x86)\Java\jdk1.6.0\U 27\
_ValidateAndroidPackageProperties:
GetAndroidPackageName任务
文件:
组件名称:helloworld-a3
PackageName:helloworld-a3.helloworld-a3
_更新DroidResgen:
正在跳过目标“_UpdateAndroidResgen”,因为所有输出文件都是相对于输入文件的最新文件。
GenerateTargetFrameworkMonitorAttribute:
跳过目标“GenerateTargetFrameworkMonitorAttribute”,因为所有输出文件相对于输入文件都是最新的。
核心编译:
跳过目标“CoreCompile”,因为所有输出文件相对于输入文件都是最新的。
CopyFilesToOutputDirectory:
helloworld-a3->C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
_转换调试文件:
正在跳过目标“_ConvertDebuggingFiles”,因为所有输出文件都是输入文件的最新版本。
_解决程序集:
解决程序集任务
ReferenceAssemblies目录:C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v2.2\;C:\ProgramFiles(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\;;
i18n部件:
链接模式:无
组件:
C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll
C:\ProgramFiles(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\System.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll
[输出]解析组件:
C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
C:\ProgramFiles(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\System.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\Mono.Security.dll
C:\Program Files(x86)\Reference Assembly\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll
[输出]ResolvedUserAssembly:
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace helloworld_a3
{
[Activity(Label = "helloworld_a3", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
}
Packaging application..
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.239]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 12/22/2011 3:27:28 PM.
Project "C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\helloworld-a3.csproj" on node 1 (SignAndroidPackage target(s)).
_GenerateAndroidAssetsDir:
Skipping target "_GenerateAndroidAssetsDir" because it has no outputs.
_GenerateAndroidResourceDir:
Copying file from "Resources\Layout\Main.axml" to "C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\obj\Debug\res\layout\main.axml".
_ResolveMonoAndroidSdks:
Looking for Android SDK..
Key HKCU\SOFTWARE\Xamarin\MonoAndroid\PrivateAndroidSdkPath found:
Path contains adb.exe in \platform-tools (C:\Users\jon\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\android-sdk-windows).
Looking for Java 6 SDK..
Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion found.
Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.6\JavaHome found:
Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.6.0_27).
MonoAndroid Tools: C:\Program Files (x86)\MSBuild\Novell\
MonoAndroid Framework: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\
Android SDK: C:\Users\jon\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\android-sdk-windows\
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_27\
_ValidateAndroidPackageProperties:
GetAndroidPackageName Task
ManifestFile:
AssemblyName: helloworld-a3
PackageName: helloworld-a3.helloworld-a3
_UpdateAndroidResgen:
Skipping target "_UpdateAndroidResgen" because all output files are up-to-date with respect to the input files.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
helloworld-a3 -> C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
_ConvertDebuggingFiles:
Skipping target "_ConvertDebuggingFiles" because all output files are up-to-date with respect to the input files.
_ResolveAssemblies:
ResolveAssemblies Task
ReferenceAssembliesDirectory: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\;;
I18nAssemblies:
LinkMode: None
Assemblies:
C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.Linq.dll
[Output] ResolvedAssemblies:
C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Mono.Security.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll
[Output] ResolvedUserAssemblies:
C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
[Output] ResolvedFrameworkAssemblies:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Mono.Security.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll
_GenerateJavaStubs:
ResolvedAssemblies:
C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\Mono.Android.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Mono.Security.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll
ResolvedUserAssemblies:
C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\bin\Debug\helloworld-a3.dll
Touching "obj\Debug\android\AndroidManifest.xml".
_AddStaticResources:
Resource obj\Debug\android\assets\machine.config is unchanged. Skipping.
Resource obj\Debug\android\src\mono\MonoRuntimeProvider.java is unchanged. Skipping.
Resource obj\Debug\android\src\mono\android\Seppuku.java is unchanged. Skipping.
_GeneratePackageManagerJava:
Skipping target "_GeneratePackageManagerJava" because all output files are up-to-date with respect to the input files.
_CreateBaseApk:
C:\Users\jon\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\android-sdk-windows\platform-tools\aapt.exe package -f -M obj\Debug\android\AndroidManifest.xml -J C:\Users\jon\AppData\Local\Temp\1uuncz32.z2o --custom-package helloworld-a3.helloworld-a3 -F obj\Debug\android\bin\packaged_resources.bk -S "C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\obj\Debug\res" -I C:\Users\jon\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\android-sdk-windows\platforms\android-8\android.jar
obj\Debug\android\AndroidManifest.xml:2: Tag <manifest> attribute package has invalid character '-'.
obj\Debug\android\AndroidManifest.xml:14: Tag <category> attribute name has invalid character '-'.
_CompileJava:
JavaSourceFiles:
JavaLibraries:
AddOnPlatformLibraries:
C:\Program Files (x86)\Java\jdk1.6.0_27\bin\javac.exe -d obj\Debug\android\bin\classes -classpath "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v2.2\mono.android.jar" -bootclasspath C:\Users\jon\AppData\Local\Xamarin\MonoForAndroid\AndroidSDK\android-sdk-windows\platforms\android-8\android.jar -encoding UTF-8 "@C:\Users\jon\AppData\Local\Temp\tmpF60D.tmp"
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(678,3): error MSB6006: "javac.exe" exited with code 1. [C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\helloworld-a3.csproj]
Done Building Project "C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\helloworld-a3.csproj" (SignAndroidPackage target(s)) -- FAILED.
Build FAILED.
"C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\helloworld-a3.csproj" (SignAndroidPackage target) (1) ->
(_CompileJava target) ->
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(678,3): error MSB6006: "javac.exe" exited with code 1. [C:\Users\jon\Documents\Visual Studio 2010\Projects\helloworld-a3\helloworld-a3\helloworld-a3.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.96
Error: Cancelled
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
obj\Debug\android\AndroidManifest.xml:2: Tag <manifest> attribute package has invalid character '-'.
obj\Debug\android\AndroidManifest.xml:14: Tag <category> attribute name has invalid character '-'.