如何在apk文件中找到robotium测试的主要活动

use*_*337 3 testing android automated-tests dropbox robotium

我有很多apk文件,我想用robotium为它们编写简单的测试.当我尝试在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>

如何理解主要活动的调用方式?我正在使用ApkAnalyser,我尝试了不同的类名和其他字符串,但是机器人测试无法启动应用程序,并写道我的项目中没有测试:/(apk在我的电脑中重新签名)我想了解,如何从apk文件中识别MainActivity?谢谢

Jam*_*art 10

我知道这已经老了,但我碰巧遇到了它.

问题是:"我想了解,如何从apk文件中识别MainActivity?" 因为你应该在你的盒子上有SDK和Build文件.请执行下列操作:

打开命令窗口/终端

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

MAC/LINUX

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

视窗

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

命令参考:徽章打印APK中声明的应用程序的标签和图标.

Android资产包装工具(aapt)获取您的应用程序资源文件,例如AndroidManifest.xml文件和您的活动的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'
Run Code Online (Sandbox Code Playgroud)

你想要寻找的是:"可发射活动"

DONE!

我希望这可以帮助别人.

Ĵ