Monodroid raises error

北城以北 提交于 2019-12-13 05:15:00

问题


I am trying run simple code which is generated by default when you create new project in Visual Studio. Emulator raises exception. It is evalution version of Mono for Android. Why that error happens? Thanks.

Here code

using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace MonoAndroidApplication1
{
[Activity(Label = "MonoAndroidApplication1", 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++); };
    }
}
}

Here error

Tried to launch activity 'MonoAndroidApplication1.MonoAndroidApplication1/monoandroidapplication1.Activity1', but the device could not find it.

A common cause of this is manually adding an to your AndroidManifest.xml whose name does not match your Activity class.

Consider using the [Activity] attribute instead: http://monodroid.net/Tutorials/Working_with_AndroidManifest.xml


回答1:


Did the application get successfully installed on your device? You can check if there is an icon for it in the app tray, or check the Settings -> Applications screen.

My guess is that the app isn't successfully installing for some reason, and the IDE isn't properly detecting the failure.




回答2:


Here information from log file 

    -- Starting Process - 30.06.2011 23:41:35 --
Executable: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe
Arguments: start-server
Appending Java path: C:\Program Files\Java\jdk1.6.0_26\bin
[STDOUT] 
-- Process Finished [5000] --
-- Starting Process - 30.06.2011 23:41:36 --
Executable: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe
Arguments: -s emulator-5554 install "C:\MonoDroid\MonoAndroidApplication2\MonoAndroidApplication2\bin\Debug\MonoAndroidApplication2.MonoAndroidApplication2-Signed.apk"
Appending Java path: C:\Program Files\Java\jdk1.6.0_26\bin
[STDOUT]    pkg: /data/local/tmp/MonoAndroidApplication2.MonoAndroidApplication2-Signed.apk
[STDOUT] 
[STDOUT] Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[STDOUT] 
[STDERR] 72 KB/s (139602 bytes in 1.883s)
-- Starting Process - 30.06.2011 23:41:54 --
Executable: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe
Arguments: start-server
Appending Java path: C:\Program Files\Java\jdk1.6.0_26\bin
[STDOUT] 
[STDERR] 
-- Process Finished [5000] --
-- Starting Process - 30.06.2011 23:41:54 --
Executable: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe
Arguments: -s emulator-5554 shell am start -a android.intent.action.MAIN -n MonoAndroidApplication2.MonoAndroidApplication2/monoandroidapplication2.Activity1
Appending Java path: C:\Program Files\Java\jdk1.6.0_26\bin
[STDOUT] Starting: Intent { act=android.intent.action.MAIN cmp=MonoAndroidApplication2.MonoAndroidApplication2/monoandroidapplication2.Activity1 }
[STDOUT] 
[STDOUT] Error type 3
[STDOUT] 
[STDOUT] Error: Activity class {MonoAndroidApplication2.MonoAndroidApplication2/monoandroidapplication2.Activity1} does not exist.
[STDOUT] 

So the error is INSTALL_PARSE_FAILED_NO_CERTIFICATES. How to resolve it? Thanks.


来源:https://stackoverflow.com/questions/6532103/monodroid-raises-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!