Unable to resolve activity for: Intent

后端 未结 7 1895
伪装坚强ぢ
伪装坚强ぢ 2021-01-17 08:21

I am having a problem in running Android unit test. I got this error when I tried to run a simple test.

Here\'s the log:

Blockquote java.la

7条回答
  •  一个人的身影
    2021-01-17 09:16

    For the keys being sent twice issue, are you sure you're not now getting both the Down and Up actions? I had this issue when using Robotium, and generated this to make things easier:

    import android.view.KeyCharacterMap;
    import android.view.KeyEvent;
    import android.widget.EditText;
    import com.jayway.android.robotium.solo.Solo;
    
            public static void type(Solo robot, EditText edit, String text) {
                int index = 0;
                //Find the index of this control, as Robotium doesn't seem to like R.id
                for (int i = 0; i < robot.getCurrentEditTexts().size(); i++) {
                    if (robot.getCurrentEditTexts().get(i).getId() == edit.getId()) {
                        index = i;
                    }
                }
    
                robot.clickOnEditText(index);
    
                KeyCharacterMap map = KeyCharacterMap.load(KeyCharacterMap.BUILT_IN_KEYBOARD);
                KeyEvent[] events = map.getEvents(text.toCharArray());
    
                for (int event = 0; event < events.length; event++) {
                    if (events[event].getAction() == KeyEvent.ACTION_DOWN) {
                        robot.sendKey(events[event].getKeyCode());
                    }
                }
            }
    

提交回复
热议问题