无法在appium中启动活动

时间:2017-10-15 08:50:21

标签: java android testing appium uiautomator

n","com.tellm.android.app/.com.jodelapp.jodelandroidv3.view.mainactivity","-S"]
[ADB] Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

[ADB] Error: Error occured while starting App. Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
    at Object.wrappedLogger.errorAndThrow (C:\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
    at ADB.callee$0$0$ (C:\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:79:9)
    at tryCatch (C:\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (
 Error: Error occured while starting App. Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity


[UiAutomator] UiAutomator shut down normally
[UiAutomator] Moving to state 'stopped'
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting all processes with uiautomator
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ZY22325Q4Q","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[UiAutomator] Moving to state 'stopped'
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'C:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ZY22325Q4Q","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
**[**MJSONWP] Encountered internal error running command: Error: Error occured while starting App. Original error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity****

,代码是:

public class Jodel {


    private static AndroidDriver driver;
    public static void main(String[] args) throws MalformedURLException {
        // TODO Auto-generated method stub



        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
        capabilities.setCapability("deviceName", "Moto G(3rd Generation)");
        capabilities.setCapability("platformVersion", "5.1.1");
        capabilities.setCapability("platformName", "Android");
        // capabilities.setCapability("app", app.getAbsolutePath());
        capabilities.setCapability("appPackage",
                "com.tellm.android.app");
        capabilities.setCapability("appActivity",
                "com.jodelapp.jodelandroidv3.view.mainactivity");
    capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT,"100");

        driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"),
                capabilities);
    }

}