我最近使用 Visual Studio 2010 Professional 安装了 monodroid 和附加组件。它似乎在新项目中有部分编码,而且它似乎不是一个有效的示例代码。它通过使用菜单中的“构建解决方案”编译得很好,但它在 android 模拟器中不起作用。我期待一个只有文件结构的空白项目,但它似乎给了我一个不完整的示例项目。这在 visual studio 2010 pro 和 monodevelop 中都会发生。
是否存在只有文件结构的空白项目?如果可以,我在哪里可以访问它们? 如果这应该是一个空白模板,那么为什么会有一些看起来像按钮计数器的代码。
谢谢 乔恩
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 '-'.
从您的项目/程序集名称中删除破折号/连字符。
关于c# - monodroid - 默认新的未修改模板项目无法在 android 模拟器中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8610982/
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
使用带有Rails插件的vim,您可以创建一个迁移文件,然后一次性打开该文件吗?textmate也可以这样吗? 最佳答案 你可以使用rails.vim然后做类似的事情::Rgeneratemigratonadd_foo_to_bar插件将打开迁移生成的文件,这正是您想要的。我不能代表textmate。 关于ruby-使用VimRails,您可以创建一个新的迁移文件并一次性打开它吗?,我们在StackOverflow上找到一个类似的问题: https://sta
我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
我正在使用puppet为ruby程序提供一组常量。我需要提供一组主机名,我的程序将对其进行迭代。在我之前使用的bash脚本中,我只是将它作为一个puppet变量hosts=>"host1,host2"我将其提供给bash脚本作为HOSTS=显然这对ruby不太适用——我需要它的格式hosts=["host1","host2"]自从phosts和putsmy_array.inspect提供输出["host1","host2"]我希望使用其中之一。不幸的是,我终其一生都无法弄清楚如何让它发挥作用。我尝试了以下各项:我发现某处他们指出我需要在函数调用前放置“function_”……这
这是在Ruby中设置默认值的常用方法:classQuietByDefaultdefinitialize(opts={})@verbose=opts[:verbose]endend这是一个容易落入的陷阱:classVerboseNoMatterWhatdefinitialize(opts={})@verbose=opts[:verbose]||trueendend正确的做法是:classVerboseByDefaultdefinitialize(opts={})@verbose=opts.include?(:verbose)?opts[:verbose]:trueendend编写Verb
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳
我想设置一个默认日期,例如实际日期,我该如何设置?还有如何在组合框中设置默认值顺便问一下,date_field_tag和date_field之间有什么区别? 最佳答案 试试这个:将默认日期作为第二个参数传递。youcorrectlysetthedefaultvalueofcomboboxasshowninyourquestion. 关于ruby-on-rails-date_field_tag,如何设置默认日期?[rails上的ruby],我们在StackOverflow上找到一个类似的问
两者都可以defsetup(options={})options.reverse_merge:size=>25,:velocity=>10end和defsetup(options={}){:size=>25,:velocity=>10}.merge(options)end在方法的参数中分配默认值。问题是:哪个更好?您更愿意使用哪一个?在性能、代码可读性或其他方面有什么不同吗?编辑:我无意中添加了bang(!)...并不是要询问nobang方法与bang方法之间的区别 最佳答案 我倾向于使用reverse_merge方法:option