ADB开始活动名称不起作用(ADB Start activity name doesn't work)

编程入门 行业动态 更新时间:2024-10-19 12:33:40
ADB开始活动名称不起作用(ADB Start activity name doesn't work)

我使用Galaxy Note 3在ADB中丢弃并记录了一些内容.Logcat给了我以下行:

#party pause( 870): onReceive android.intent.action.ACTIVITY_STATE/th.in.siamgame.ggplay.mwcasia/resume

另一个dumpfile告诉我包名是:

th.in.siamgame.ggplay.mwcasia

我尝试了一些ADB Start命令的变体。

adb shell am start -n th.in.siamgame.ggplay.mwcasia/th.in.siamgame.ggplay.mwcasia.resume adb shell am start -n th.in.siamgame.ggplay.mwcasia/.resume

在这两个命令上也有

-a android.intent.action.ACTIVITY_STATE

我希望你们能帮助我通过亚行启动该应用程序。

I dumped and logged a few things in ADB with my Galaxy Note 3. Logcat gave me following line:

#party pause( 870): onReceive android.intent.action.ACTIVITY_STATE/th.in.siamgame.ggplay.mwcasia/resume

And another dumpfile told me that the package name is :

th.in.siamgame.ggplay.mwcasia

I tried a few variations of my ADB Start command.

adb shell am start -n th.in.siamgame.ggplay.mwcasia/th.in.siamgame.ggplay.mwcasia.resume adb shell am start -n th.in.siamgame.ggplay.mwcasia/.resume

On both of those commands also with

-a android.intent.action.ACTIVITY_STATE

I hope you guys can help me with starting that app via ADB.

最满意答案

该命令的正确语法是:

adb shell am start -n package/.activity

例如:

adb shell am start -n com.example/.ActivityName

似乎resume不是活动的名称。 您可以在AndroidManifest.xml找到主要活动名称(如果您有源代码)。 它是具有intent过滤器属性的那个:

<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />

如果你没有源代码,但有apk文件,你仍然可以使用aapt工具找到它。 aapt位于<android-sdk-path>/build-tools/<version>/aapt 。 用命令aapt l -a filename.apk启动它,你会得到如下输出:

N: android=http://schemas.android.com/apk/res/android E: manifest (line=2) A: android:versionCode(0x0101021b)=(type 0x10)0xc A: android:versionName(0x0101021c)="1.0.1" (Raw: "1.0.1") A: package="com.example" (Raw: "com.example") E: application (line=8) A: android:theme(0x01010000)=@0x7f0d0022 A: android:label(0x01010001)=@0x7f0b0000 A: android:icon(0x01010002)=@0x7f020002 A: android:name(0x01010003)="AppName" (Raw: "AppName") A: android:debuggable(0x0101000f)=(type 0x12)0x0 E: activity (line=15) A: android:label(0x01010001)=@0x7f0b0000 A: android:name(0x01010003)=".MainActivity" (Raw: ".MainActivity") A: android:launchMode(0x0101001d)=(type 0x10)0x2 A: android:configChanges(0x0101001f)=(type 0x11)0xb0 E: intent-filter (line=21) E: action (line=22) A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN") E: category (line=25) A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER") ... etc ...

而且你需要"android.intent.action.MAIN"和"android.intent.category.LAUNCHER" 。 在示例中是.MainActivity 。

Proper syntax of the command is:

adb shell am start -n package/.activity

For example:

adb shell am start -n com.example/.ActivityName

It seems resume isn't the name of activity. You can find main activity name in the AndroidManifest.xml (if you have source code of course). It's the one with the attributes in intent filter:

<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />

If you don't have source code, but have apk file, you still can find it with the aapt tool. aapt located in the <android-sdk-path>/build-tools/<version>/aapt. Start it with command aapt l -a filename.apk and you will get output like this:

N: android=http://schemas.android.com/apk/res/android E: manifest (line=2) A: android:versionCode(0x0101021b)=(type 0x10)0xc A: android:versionName(0x0101021c)="1.0.1" (Raw: "1.0.1") A: package="com.example" (Raw: "com.example") E: application (line=8) A: android:theme(0x01010000)=@0x7f0d0022 A: android:label(0x01010001)=@0x7f0b0000 A: android:icon(0x01010002)=@0x7f020002 A: android:name(0x01010003)="AppName" (Raw: "AppName") A: android:debuggable(0x0101000f)=(type 0x12)0x0 E: activity (line=15) A: android:label(0x01010001)=@0x7f0b0000 A: android:name(0x01010003)=".MainActivity" (Raw: ".MainActivity") A: android:launchMode(0x0101001d)=(type 0x10)0x2 A: android:configChanges(0x0101001f)=(type 0x11)0xb0 E: intent-filter (line=21) E: action (line=22) A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN") E: category (line=25) A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER") ... etc ...

And again you need "android.intent.action.MAIN" and "android.intent.category.LAUNCHER". It is .MainActivity in the example.

更多推荐

ADB,mwcasia,ggplay,siamgame,电脑培训,计算机培训,IT培训"/> <meta name="d

本文发布于:2023-08-02 20:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1379597.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   名称   ADB   work   activity

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!