开始与亚行活动 [英] Start activity with adb

查看:431
本文介绍了开始与亚行活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个最简单的可能测试应用程序,与xamarin开发,部署到USB连接的机器人。具有一个一天的工作意图URL的目标,我想打电话给我与亚行的shell上午的主要活动。这里是我的MainActivity的前几行...

I have a simplest possible test app, developed with xamarin, deployed to a usb connected droid. With the goal of having one day a working intent url, I'm trying to call my main activity with adb shell am. Here are the first few lines of my MainActivity...

namespace DematAEAT_Android
{
    [Activity(Label = "DematAEAT_Android", MainLauncher = true, Icon = "@drawable/icon")]
    [IntentFilter(new[] { "AcquireSignedImage" },
        Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault })]
    public class MainActivity : Activity
    {
        int count = 1;

下面是两个shell命令。在第一个,包管理器成功地理解包名称和报告的apk路径。第二,活动管理无法解决类MainActivity。它失败,或者没有命名空间。

Here are two shell commands. In the first, the package manager successfully understands the package name and reports the apk path. In the second, the activity manager fails to resolve the class MainActivity. It fails with or without the namespace.

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb -d shell pm path "fr.company.DematAEAT_Android"
package:/data/app/fr.company.DematAEAT_Android-1/base.apk

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb -d shell am start -n "fr.company.DematAEAT_Android/.DematAEAT_Android.MainActivity"
Starting: Intent { cmp=fr.company.DematAEAT_Android/.DematAEAT_Android.MainActivity }
Error type 3
Error: Activity class {fr.company.DematAEAT_Android/fr.company.DematAEAT_Android.DematAEAT_Android.MainActivity} does not exist.

编辑...
然而,我可以用猴子高兴地推出。下面的命令工作正常。提斯仿佛有一个与我命名我的活动类的亚行外壳上午呼叫的方式有问题,但我无法发现它。

edit... And yet, I can launch happily using monkey. The following command works fine. Tis as if there's a problem with the way I'm naming my activity class in the adb shell am call, but I can't spot it.

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb shell monkey -p fr.company.DematAEAT_Android 1
Events injected: 1
## Network stats: elapsed time=170ms (0ms mobile, 0ms wifi, 170ms not connected)

谁能告诉我如何调用这个活动?

Can anyone tell me how to call this activity?

推荐答案

嘛,谁知道?我需要的grub围绕在我的manifest.xml发现,xamarin被追加一个散列为命名空间在我的活动名称的前面。这样的工作,亚行呼吁看起来像这样...

Well who knew? I needed to grub around in my manifest.xml to discover that xamarin is appending a hash as a namespace in front of my activity name. So the adb call that works looks like this...

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb -d shell am start -n fr.company.DematAEAT_Android/md5abda05033ab0415fc7a776c5d9734c74.BrowsableActivity
Starting: Intent { cmp=fr.company.DematAEAT_Android/md5abda05033ab0415fc7a776c5d9734c74.BrowsableActivity }

故事继续<一href=\"http://stackoverflow.com/questions/33897245/why-is-xamarin-appending-a-hash-as-a-namespace\">here.这很可能会成为任何试图通过启动亚行外​​壳上午一xamarin活动,或者试图启动一个xamarin活动,意图或目的地址的问题。

The story continues here. This will likely be an issue for anyone trying to start a xamarin activity via adb shell am, or trying to start a xamarin activity with an intent, or an intent url.

这篇关于开始与亚行活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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