Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

monodroid - default new untouched template project cannot run in android emulator

I have recently install monodroid and the add-on with Visual Studio 2010 Professional. It appears to have partial coding in the new project and it does not seem to be a working sample code. It compiles fine from using the "build solution" in menu, but it does not work in the android emulator. I was expecting a blank project with file structures only, but it seem to give me a incomplete sample project. This occurs both with visual studio 2010 pro and monodevelop.

Is there a blank project with only file structures? if so where can I access them? if this is suppose to be a blank template, then why is there some code that seems to look like a button counter.

Thanks Jon


codes in the activity.cs from the new/untouched project

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++); };
        }
    }
}

the output after I try to run on android emulator

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 ==========
like image 524
user1112612 Avatar asked Dec 22 '11 23:12

user1112612


1 Answers

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 '-'.

Remove the dash/hyphen from your project/assembly name.

like image 97
jpobst Avatar answered Oct 30 '22 23:10

jpobst