不能得到这个亚行外壳上午开始行工作 [英] cannot get this adb shell am start line to work

查看:145
本文介绍了不能得到这个亚行外壳上午开始行工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发动对我的模拟器这个应用程序。这里是我的亚行的shell日上午开始行

I am trying to launch this app on my emulator.. Here is my adb shell am start line

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>adb shell am start -n com.example.harvey.Sunshinea1app/com.example.harvey.Sunshinea1app.MainActivity
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Starting: Intent { cmp=com.example.harvey.Sunshinea1app/.MainActivity }
Error type 3
Error: Activity class {com.example.harvey.Sunshinea1app/com.example.harvey.Sunshinea1app.MainActivity} does not exist.

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>

我知道该警告是没有这样一个问题,但在MainActivity不存在该消息的一部分是指向是从能够启动该程序停止命令的问题。

I know the warning isn't such an issue but the MainActivity does not exist part of that message is pointing to an issue that is stopping the command from being able to start the program.

我知道我有一些错误有关的路径或名称,但我什么也看不见。我想我是一个有点什么就是什么困惑。毫无疑问,我已经写的路径不对的地方,但我不知道在哪里。

I know I have something wrong in regarding the path or the name but I can't see what. I guess i'm a bit confused by what is what. No doubt i've written the path wrong somewhere but I don't know where.

下面是一个DIR阳光* / S / B

Here is a dir Sunshine* /s/b

我想这可能会给一些信息,可以帮助确定亚行线应该是什么。如果您需要任何其他信息,请发表评论让我知道。

I guess it might give some info that may help to determine what that adb line should be. If you need any other info please comment letting me know.

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>dir Sunshine*.* /s/b
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\Sunshinea1.iml
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\generated\source\buildConfig\debug\com\example\harvey\sunshinea1app
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\generated\source\buildConfig\debug\com\example\harvey\sunshinea1app\sunshinea1
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\generated\source\buildConfig\test\debug\com\example\harvey\sunshinea1app
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\generated\source\buildConfig\test\debug\com\example\harvey\sunshinea1app\sunshinea1
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\generated\source\r\debug\com\example\harvey\sunshinea1app
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\generated\source\r\debug\com\example\harvey\sunshinea1app\sunshinea1
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\intermediates\classes\debug\com\example\harvey\sunshinea1app
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\intermediates\classes\debug\com\example\harvey\sunshinea1app\sunshinea1
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\src\androidTest\java\com\example\harvey\sunshinea1app
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\src\androidTest\java\com\example\harvey\sunshinea1app\sunshinea1
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\src\main\java\com\example\harvey\sunshinea1app
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\src\main\java\com\example\harvey\sunshinea1app\sunshinea1

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>

修改
在收到此错误

EDIT was getting this error

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>adb shell monkey -p com.example.harvey.Sunshinea1app -c android.intent.category.LAUNCHER 1
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
** No activities found to run, monkey aborted.

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>

综观卡罗的回答,我已经决定在这个问题我的包的名字,这从MainActivity.java

Looking at carlo's answer, i've decided to include my package name in the question, this from MainActivity.java

至于我的包名

C:\>type C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\src\main\java\com\exampl
e\harvey\sunshinea1app\sunshinea1\MainActivity.java | grep package

package com.example.harvey.sunshinea1app.sunshinea1;

C:\>

所以,现在我已经修改了包线中的亚行外壳猴行

So now i've revised the package line in the adb shell monkey line

C:\>adb shell monkey -p com.example.harvey.sunshinea1app.sunshinea1 -c android.intent.
category.LAUNCHER 1
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a secur
ity risk. Please fix.
Events injected: 1
## Network stats: elapsed time=85ms (0ms mobile, 0ms wifi, 85ms not connected)

亚行壳猴行不现在的工作。

the adb shell monkey line does work now..

C:\>adb devices
List of devices attached
emulator-5554   device


C:\>

不过,亚行外壳上午线是不是<​​/ P>

But the adb shell am line isn't

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>dir MainActivity.class /s/b
C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\intermediates\classes\debug\com\example\harvey\sunshinea1app\sunshinea1\MainActivity.class

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>

在亚行的shell日上午开始尝试

attempts at adb shell am start

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>adb shell am start -n com.example.harvey.sunshinea1app/com.example.harvey.sunshinea1app.MainActivity
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Starting: Intent { cmp=com.example.harvey.sunshinea1app/.MainActivity }
Error type 3
Error: Activity class {com.example.harvey.sunshinea1app/com.example.harvey.sunshinea1a
pp.MainActivity} does not exist.

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>adb shell am start -n com.example.harvey.sunshinea1app/com.example.harvey/.sunshinea1app/.MainActivity
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Starting: Intent { cmp=com.example.harvey.sunshinea1app/com.example.harvey/.sunshinea1
app/.MainActivity }
Error type 3
Error: Activity class {com.example.harvey.sunshinea1app/com.example.harvey/.sunshinea1
app/.MainActivity} does not exist.

C:\Users\harvey\AndroidStudioProjects\Sunshinea1>

我检查这个QNA

I checked this QnA

<一个href=\"http://stackoverflow.com/questions/20230285/error-activity-class-does-not-exist-when-launching-android-app-with-adb-shell\">error &QUOT;活动类不存在&QUOT;开展与亚行的shell上午Android应用程序启动时

其中有检查的logcat的想法
然后做亚行的shell上午,然后-a(用于接下来的行为=)-C(用于接下来的猫=)基于输出和-n(用于接下来CMP =)。

which had the idea of checking logcat then doing adb shell am and then -a(for what follows act=) -c(for what follows cat=) and -n(for what follows cmp=) based on the output..

02-09 18:04:05.763    1277-1288/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.harvey.sunshinea1app.sunshinea1/.MainActivity} from pid 1781

不过,这并不正常工作

But it doesn't work

迪尔MainActivity.class / S / B
显示MainActivity.class存储在这里。

dir MainActivity.class /s/b shows MainActivity.class is stored here

C:\\Users\\harvey\\AndroidStudioProjects\\Sunshinea1\\app\\build\\intermediates\\classes\\debug\\com\\example\\harvey\\sunshinea1app\\sunshinea1\\MainActivity.class

C:\Users\harvey\AndroidStudioProjects\Sunshinea1\app\build\intermediates\classes\debug\com\example\harvey\sunshinea1app\sunshinea1\MainActivity.class

我运行的adb外壳日上午开始的命令,用-c -a和-n,但它并没有找到类

I run the adb shell am start command, with -a -c and -n, but it doesn't find the class

C:\>adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n com.example.harvey.sunshinea1app.sunshinea1/.MainActivity
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.harvey.sunshinea1app.sunshinea1/.MainActivity }
Error type 3
Error: Activity class {com.example.harvey.sunshinea1app.sunshinea1/com.example.harvey.
sunshinea1app.sunshinea1.MainActivity} does not exist.

C:\>

试图评论的建议

C:\>adb shell am start -n com.example.harvey.sunshinea1app/com.example.harvey/.sunshinea1app.MainActivity
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Starting: Intent { cmp=com.example.harvey.sunshinea1app/com.example.harvey/.sunshinea1
app.MainActivity }
Error type 3
Error: Activity class {com.example.harvey.sunshinea1app/com.example.harvey/.sunshinea1app.MainActivity} does not exist.

C:\>

所建议的评论,但仍然是一个更好的尝试失败

a better attempt as suggested in the comment, but still fails

C:\>adb shell am start -n com.example.harvey.sunshinea1app/.sunshinea1.MainActivity
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Starting: Intent { cmp=com.example.harvey.sunshinea1app/.sunshinea1.MainActivity }
Error type 3
Error: Activity class {com.example.harvey.sunshinea1app/com.example.harvey.sunshinea1app.sunshinea1.MainActivity} does not exist.

C:\>

下面是从devtools包管理器一个PIC的sunshinea1应用程序,我试图做亚行外壳上午开始。

Here is a pic from devtools package manager for the sunshinea1 app that I am trying to do adb shell am start on.

推荐答案

您可以使用下面的命令,只需要在应用程序的包名启动应用程序:

You can launch the app using the following command which only needs the package name of the app:

adb shell monkey -p com.example.harvey.Sunshinea1app -c android.intent.category.LAUNCHER 1

至于为什么你的命令不起作用,我无法从所提供的信息说,但我怀疑问题出在哪里MainActivity类别位于您的包结构。如果在MainActivity类是在 com.example.harvey.sunshinea1app.sunshinea1 则需要下面的命令:

adb shell am start -n com.example.harvey.sunshinea1app/.sunshinea1.MainActivity

此外,还应确保您使用的是包的名称是否正确,并在正确的字母外壳。

Also ensure that the package name you are using is correct and in the correct letter casing.

修改通过barlop 结果
卡罗指出在评论,它的工作原理 -

Edit by barlop
Carlo points out in comment, and it works-

亚行外壳上午开始-n com.example.harvey.sunshinea1app.sunshinea1 / .MainActivity

adb shell am start -n com.example.harvey.sunshinea1app.sunshinea1/.MainActivity

这篇关于不能得到这个亚行外壳上午开始行工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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