无法使用Appium安装应用程序

时间:2017-04-25 02:11:06

标签: appium

我正在尝试设置和运行Appium。我已经下载了运行它所需的一切。

这是Appium-doctor的输出,只是为了证明:

info AppiumDoctor Appium Doctor v.1.4.2
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ Node version is 5.0.0
info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/shasharma/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home
info AppiumDoctor  ✔ adb exists at: /Users/shasharma/Library/Android/sdk/platform-tools/adb
info AppiumDoctor  ✔ android exists at: /Users/shasharma/Library/Android/sdk/tools/android
info AppiumDoctor  ✔ emulator exists at: /Users/shasharma/Library/Android/sdk/tools/emulator
info AppiumDoctor  ✔ Bin directory of $JAVA_HOME is set
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor 
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor

我正在尝试运行的代码:

package com.groupon;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.remote.DesiredCapabilities;

public class ApplicationEndTest {

    @SuppressWarnings("rawtypes")
    private static AndroidDriver driver;


    @SuppressWarnings("rawtypes")
    public static void main(String[] args) throws MalformedURLException, InterruptedException {


        File app = new File("//Users//shasharma//Documents//workspace//CMPE287TeamProject2Appium//groupon.apk");
        System.out.println(app.getAbsolutePath());
        DesiredCapabilities capabilities = new DesiredCapabilities();
        //capabilities.setCapability(MobileCapabilityType.APPIUM_VERSION, "1.6.4");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator-5554");
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1.1");
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        //capabilities.setCapability(MobileCapabilityType., "com.groupon");
        //capabilities.setCapability("appActivity", value);
        capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
        //capabilities.setCapability(MobileCapabilityType., value);

        driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
        driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
        Thread.sleep(10000);
        driver.quit();

    }

}

当我运行此代码时,这是我不断得到的错误。我已经在互联网上搜索结果,但我不确定我错过了什么。

The server is running
Start New SessionStop Server
[Appium] Welcome to Appium v1.6.4
[Appium] Non-default server args:
[Appium]   address: 127.0.0.1
[Appium]   sessionOverride: true
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[HTTP] --> POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"}},{"requiredCapabilities":{}}],"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"},"requiredCapabilities":{}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"},{},[{"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"}},{"requiredCapabilities":{}}],null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1493086147232 (19:09:07 GMT-0700 (PDT))
[Appium] Creating new AndroidDriver (v1.17.1) session
[Appium] Capabilities:
[Appium]   app: '/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk'
[Appium]   platformName: 'Android'
[Appium]   deviceName: 'emulator-5554'
[Appium]   appiumVersion: '1.6.4'
[Appium]   platformVersion: '7.1.1'
[AndroidDriver] AndroidDriver version: 1.17.1
[BaseDriver] The following capabilities were provided, but are not recognized by appium: appiumVersion.
[BaseDriver] Session created with session id: c3f0b693-2e57-4e40-ad24-84e0c51d1c5a
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_73
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/shasharma/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '7.1.1'
[ADB] Setting device id to emulator-5554
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[AndroidDriver] Using device: emulator-5554
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/shasharma/Library/Android/sdk/platform-tools/adb
[ADB] Setting device id to emulator-5554
[BaseDriver] Using local app '/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk'
[AndroidDriver] Checking whether app is actually present
[AndroidDriver] Starting Android session
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","wait-for-device"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","echo","ping"]
[Logcat] Starting logcat capture
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","io.appium.settings"]
[ADB] App is installed
[ADB] Getting package info for io.appium.settings
[ADB] Getting connected devices...
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/shasharma/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] Cannot read version codes of /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/io.appium.settings/app/build/outputs/apk/settings_apk-debug.apk and/or io.appium.settings. Assuming correct app version is already installed
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.sdk"]
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","dump","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[AndroidDriver] Pushing unlock helper app to device...
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[ADB] Application '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk' already installed. Continuing.
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","appops","set","io.appium.settings","android:mock_location","allow"]
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","wm","size"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.model"]
[ADB] Current device property 'ro.product.model': Android SDK built for x86
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.manufacturer"]
[ADB] Current device property 'ro.product.manufacturer': unknown
[AndroidDriver] Parsing package and activity from app manifest
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/shasharma/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] Extracting package and launch activity from manifest
[ADB] Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at process._tickCallback (internal/process/next_tick.js:103:7)
 Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at process._tickCallback (internal/process/next_tick.js:103:7)
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[MJSONWP] Encountered internal error running command: Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at process._tickCallback (internal/process/next_tick.js:103:7)
[HTTP] <-- POST /wd/hub/session 500 3500 ms - 234 
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"},"requiredCapabilities":{}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"},{},null,null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1493086150750 (19:09:10 GMT-0700 (PDT))
[Appium] Creating new AndroidDriver (v1.17.1) session
[Appium] Capabilities:
[Appium]   app: '/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk'
[Appium]   platformName: 'Android'
[Appium]   deviceName: 'emulator-5554'
[Appium]   appiumVersion: '1.6.4'
[Appium]   platformVersion: '7.1.1'
[AndroidDriver] AndroidDriver version: 1.17.1
[BaseDriver] The following capabilities were provided, but are not recognized by appium: appiumVersion.
[BaseDriver] Session created with session id: a078f599-9622-437f-b437-dfa5a25d7610
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_73
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/shasharma/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '7.1.1'
[ADB] Setting device id to emulator-5554
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[AndroidDriver] Using device: emulator-5554
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/shasharma/Library/Android/sdk/platform-tools/adb
[ADB] Setting device id to emulator-5554
[BaseDriver] Using local app '/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk'
[AndroidDriver] Checking whether app is actually present
[AndroidDriver] Starting Android session
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","wait-for-device"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","echo","ping"]
[Logcat] Starting logcat capture
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","io.appium.settings"]
[ADB] App is installed
[ADB] Getting package info for io.appium.settings
[ADB] Getting connected devices...
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/shasharma/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] Cannot read version codes of /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/io.appium.settings/app/build/outputs/apk/settings_apk-debug.apk and/or io.appium.settings. Assuming correct app version is already installed
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.sdk"]
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","dump","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[AndroidDriver] Pushing unlock helper app to device...
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[ADB] Application '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk' already installed. Continuing.
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","appops","set","io.appium.settings","android:mock_location","allow"]
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","wm","size"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.model"]
[ADB] Current device property 'ro.product.model': Android SDK built for x86
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.manufacturer"]
[ADB] Current device property 'ro.product.manufacturer': unknown
[AndroidDriver] Parsing package and activity from app manifest
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/shasharma/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] Extracting package and launch activity from manifest
[ADB] Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
 Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[MJSONWP] Encountered internal error running command: Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
    at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
    at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
    at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session 500 2980 ms - 234 
[HTTP] --> POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"}},{"requiredCapabilities":{}}]}
[MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","capabilities","sessionId","id"]} and you sent ["capabilities"]
[HTTP] <-- POST /wd/hub/session 400 1 ms - 171 

1 个答案:

答案 0 :(得分:0)

我认为以下行可能是您的问题:

capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator-5554");

“emulator-5554”是它提供的通用名称,无论当前运行的设备如何,我相信。您应该在创建时传递您调用设备(模拟器)的文字名称。在我的应用中,我使用:

String deviceName = "Nexus 6P API 23";

然后我只传递 deviceName 作为参数。一如既往,您的里程可能会有所不同。