gpt4 book ai didi

android - 如何在 apk 文件中找到用于机器人测试的主要 Activity

转载 作者:太空宇宙 更新时间:2023-11-03 11:33:30 27 4
gpt4 key购买 nike

我有很多 apk 文件,我想用 robotium 为它们编写简单的测试。我有一些问题,当我试图为他们找到主要 Activity 时,例如在 Dropbox 应用程序中。在 AndroidManifest.xml 中我发现了这个:

</activity>
<provider android:name=".provider.ZipperedMediaProvider" android:exported="false" android:authorities="com.dropbox.android.ZipperedMediaProvider"></provider>
<provider android:name=".provider.CameraUploadsProvider" android:exported="false" android:authorities="com.dropbox.android.CameraUploadsProvider"></provider>
<activity android:theme="@android:01030055" android:name=".activity.DropboxBrowser">
<intent-filter >
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
<intent-filter android:label="Dropbox File Browser">
<action android:name="com.dropbox.BROWSE"></action>
<action android:name="android.intent.action.VIEW"></action>
<action android:name="android.intent.action.EDIT"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<data android:mimeType="vnd.android.cursor.dir/vnd.dropbox.entry"></data>
<data android:mimeType="vnd.android.cursor.item/vnd.dropbox.entry"></data>
</intent-filter>
</activity>

怎么理解main activity是怎么调用的?我正在使用 ApkAnalyser,我尝试了不同的类名和其他字符串,但是 robotium test 无法启动应用程序并写道我的项目中没有测试:/(apk 在我的 PC 中重新签名)我想了解,如何从 apk 文件中识别 MainActivity?谢谢

最佳答案

我知道这很旧,但我碰巧遇到了它。

问题是:“我想了解,如何从 apk 文件中识别 MainActivity?”因为你应该在你的盒子上有 SDK 和构建文件。执行以下操作:

打开命令窗口/终端

cd <SDK PATH>/build-tools/<BUILD TOOLS #>/

苹果电脑/Linux

./aapt dump badging <path to the APK file>

window

aapt.exe dump badging <path to the APK file>

命令引用:badging 打印 APK 中声明的应用的标签和图标。

Android Assets 打包工具 (aapt) 获取您的应用程序资源文件,例如 AndroidManifest.xml 文件和您的 Activity 的 XML 文件,并编译它们。

http://developer.android.com/tools/building/index.html

输出将是这样的:

./aapt dump badging  ~/Documents/Projects/Eclipse/AndroidAutomation/Application/Project-debug-0.9.0.65.apk 
package: name='com.company.mobile.debug' versionCode='1' versionName='0.9.0.65-QADrop' platformBuildVersionName=''
sdkVersion:'15'
targetSdkVersion:'19'
uses-permission: name='android.permission.INTERNET'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
application-label:'Company-QADrop'
application-icon-160:'res/drawable-hdpi-v4/ic_launcher.png'
application-icon-240:'res/drawable-hdpi-v4/ic_launcher.png'
application-icon-320:'res/drawable-xhdpi-v4/ic_launcher.png'
application-icon-480:'res/drawable-xxhdpi-v4/ic_launcher.png'
application: label='Company-QADrop' icon='res/drawable-hdpi-v4/ic_launcher.png'
application-debuggable
launchable-activity: name='com.company.mobile.default' label='' icon=''
feature-group: label=''
uses-feature: name='android.hardware.screen.portrait'
uses-implied-feature: name='android.hardware.screen.portrait' reason='one or more activities have specified a portrait orientation'
uses-feature: name='android.hardware.touchscreen'
uses-implied-feature: name='android.hardware.touchscreen' reason='default feature for all apps'
main
other-activities
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--'
densities: '160' '240' '320' '480'

您要寻找的是:“launchable-activity”

完成!

我希望这对某人有所帮助。

J

关于android - 如何在 apk 文件中找到用于机器人测试的主要 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15497672/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com