Java Android Emulator未将活动启动到前台
我正在Eclipse中使用Robotium运行一个自动测试(作为Android jUnit测试运行),当我第一次启动模拟器时,应用程序不会在前台运行,测试失败。如果我保持模拟器打开,按下“主菜单”按钮,然后运行测试,它工作正常。该测试正在一个测试项目(记事本)中运行一些事件 当应用程序第一次打开模拟器时,有什么解决方案可以将其推到前台吗 这是测试项目的清单Java Android Emulator未将活动启动到前台,java,android,eclipse,emulation,robotium,Java,Android,Eclipse,Emulation,Robotium,我正在Eclipse中使用Robotium运行一个自动测试(作为Android jUnit测试运行),当我第一次启动模拟器时,应用程序不会在前台运行,测试失败。如果我保持模拟器打开,按下“主菜单”按钮,然后运行测试,它工作正常。该测试正在一个测试项目(记事本)中运行一些事件 当应用程序第一次打开模拟器时,有什么解决方案可以将其推到前台吗 这是测试项目的清单 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:androi
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jayway.test"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-library android:name="android.test.runner" />
这是实际项目的清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.notepad" >
<application android:icon="@drawable/app_notes"
android:label="@string/app_name" >
<provider android:name="NotePadProvider"
android:authorities="com.example.notepad.provider.NotePad" />
<activity android:name="NotesList"
android:label="@string/title_notes_list">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.google.note" />
</intent-filter>
</activity>
<activity android:name="NoteEditor"
android:theme="@android:style/Theme.Light"
android:configChanges="keyboardHidden|orientation">
<!-- This filter says that we can view or edit the data of
a single note -->
<intent-filter android:label="@string/resolve_edit">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="com.android.notes.action.EDIT_NOTE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.google.note" />
</intent-filter>
</activity>
<activity android:name="NotesLiveFolder" android:label="@string/live_folder_name"
android:icon="@drawable/live_folder_notes">
<intent-filter>
<action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10"/>
</manifest>
</application>
<uses-sdk android:minSdkVersion="10" />
<instrumentation android:targetPackage="com.example.android.notepad" android:name="android.test.InstrumentationTestRunner" />
</manifest>
我用这个命令解决了这个问题 adb外壳输入键事件82
这会唤醒仿真器/设备。我用这个命令解决了这个问题 adb外壳输入键事件82
这会唤醒模拟器/设备。我建议您添加一些相关代码;你在测试什么;并且可能会有一些日志输出供其他人使用。另外,假设您在调试中运行此程序以进行检查,那么您的应用程序在什么时候会卡住?如果没有,可能会有帮助。我在上面展示了清单XML代码,这个测试不会在调试中运行,因为它是junit测试应用程序。日志很长,没有错误。当模拟器进入主屏幕时,应用程序无法打开,您需要按下菜单按钮,应用程序才能进入前台。我建议您添加一些相关代码;你在测试什么;并且可能会有一些日志输出供其他人使用。另外,假设您在调试中运行此程序以进行检查,那么您的应用程序在什么时候会卡住?如果没有,可能会有帮助。我在上面展示了清单XML代码,这个测试不会在调试中运行,因为它是junit测试应用程序。日志很长,没有错误。当模拟器进入主屏幕时,应用程序将无法打开,您需要按下菜单按钮,应用程序才能进入前台。