appium java中报错
> Launching Appium server with command: D:\BaiduYunDownload\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --app D:\BaiduYunDownload\ContactManager.apk --platform-name Android --platform-version 19 --automation-name Appium --device-name "Coolpad 5952" --log-no-color> info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
> info: Appium REST http interface listener started on 127.0.0.1:4723
> info: Non-default server args: {"app":"D:\\BaiduYunDownload\\ContactManager.apk","address":"127.0.0.1","logNoColors":true,"deviceName":"Coolpad 5952","platformName":"Android","platformVersion":"19","automationName":"Appium"}
> info: Console LogLevel: debug
> info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"F:\\andriodproject\\AppLogin\\apps\\glvip20160317beta.apk","platformVersion":"4.3","deviceName":"Coolpad 5952","platformName":"Android","appActivity":".glvip20160317beta","browserName":"","appPackage":"com.example.android.glvip20160317beta"}}
> info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
> info: Using local app from desired caps: F:\andriodproject\AppLogin\apps\glvip20160317beta.apk
> info: Creating new appium session 5845154b-da26-44b0-8d16-fe13b88de72f
> info: Starting android appium
> info: Getting Java version
> info: Java version is: 1.6.0
> info: Checking whether adb is present
> info: Using adb from D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe
> info: Using fast reset? true
> info: Preparing device for session
> info: Checking whether app is actually present
> info: Retrieving device
> info: Trying to find a connected android device
> info: Getting connected devices...
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe devices
> info: 1 device(s) connected
> info: Found device c1c6562
> info: Setting device id to c1c6562
> info: Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 wait-for-device
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "echo 'ready'"
> info: Starting logcat capture
> info: Getting device API level
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "getprop ro.build.version.sdk"
> info: Device is at API Level 18
> info: Device API level is: 18
> info: Extracting strings for language: default
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "getprop persist.sys.language"
> info: Current device persist.sys.language: zh
> info: java -jar "D:\BaiduYunDownload\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools_1.6.jar" "stringsFromApk" "F:\andriodproject\AppLogin\apps\glvip20160317beta.apk" "C:\Users\ADMINI~1\AppData\Local\Temp\com.example.android.glvip20160317beta" zh
> info: No strings.xml for language 'zh', getting default strings.xml
> info: java -jar "D:\BaiduYunDownload\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools_1.6.jar" "stringsFromApk" "F:\andriodproject\AppLogin\apps\glvip20160317beta.apk" "C:\Users\ADMINI~1\AppData\Local\Temp\com.example.android.glvip20160317beta"
> warn: Error getting strings.xml from apk
> info: Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
> at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:54)
> at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:540)
> at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:76)
> at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:68)
> at io.appium.apktools.StringsXML.run(StringsXML.java:84)
> at io.appium.apktools.Main.main(Main.java:31)
> Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
> at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
> at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:43)
> at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:100)
> at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
> at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
> ... 5 more
>
> warn: Could not get strings, continuing anyway
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "echo '{}' > /data/local/tmp/strings.json"
> info: Checking whether aapt is present
> info: Using aapt from D:\BaiduYunDownload\sdk\sdk\build-tools\android-4.4\aapt.exe
> info: Retrieving process from manifest.
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\build-tools\android-4.4\aapt.exe dump xmltree F:\andriodproject\AppLogin\apps\glvip20160317beta.apk AndroidManifest.xml
> info: Set app process to: com.example.android.glvip20160317beta
> info: Not uninstalling app since server not started with --full-reset
> info: Checking app cert for F:\andriodproject\AppLogin\apps\glvip20160317beta.apk.
> info: executing cmd: java -jar D:\BaiduYunDownload\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar F:\andriodproject\AppLogin\apps\glvip20160317beta.apk
> info: App not signed with debug cert.
> info: Resigning apk.
> info: executing cmd: java -jar D:\BaiduYunDownload\Appium\node_modules\appium\node_modules\appium-adb\jars\sign.jar F:\andriodproject\AppLogin\apps\glvip20160317beta.apk --override
> info: Zip-aligning F:\andriodproject\AppLogin\apps\glvip20160317beta.apk
> info: Checking whether zipalign is present
> info: Using zipalign from D:\BaiduYunDownload\sdk\sdk\tools\zipalign.exe
> info: Zip-aligning apk.
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\tools\zipalign.exe -f 4 F:\andriodproject\AppLogin\apps\glvip20160317beta.apk C:\Users\ADMINI~1\AppData\Local\Temp\116221-5776-1jufk1r\appium.tmp
> info: MD5 for app is c60364d78e47cc740796791b468ff7cb
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "ls /data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk"
> info: Getting install status for com.example.android.glvip20160317beta
> info: Getting device API level
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "getprop ro.build.version.sdk"
> info: Device is at API Level 18
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "pm list packages -3 com.example.android.glvip20160317beta"
> info: App is not installed
> info: Installing App
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "mkdir -p /data/local/tmp/"
> info: Removing any old apks
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "ls /data/local/tmp/*.apk"
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell rm "/data/local/tmp/635eb4912b1b11c520eab2d2b6a11ea4.apk"
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 push "F:\\andriodproject\\AppLogin\\apps\\glvip20160317beta.apk" /data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk
> info: Uninstalling com.example.android.glvip20160317beta
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "am force-stop com.example.android.glvip20160317beta"
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 uninstall com.example.android.glvip20160317beta
> info: App was not uninstalled, maybe it wasn't on device?
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "pm install -r /data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk"
> warn: Installing remote apk failed, going to uninstall and try again
> info: Removing any old apks
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "ls /data/local/tmp/*.apk"
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell rm "/data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk"
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 push "F:\\andriodproject\\AppLogin\\apps\\glvip20160317beta.apk" /data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk
> info: Attempting to install again for the last time
> info: executing cmd: D:\BaiduYunDownload\sdk\sdk\platform-tools\adb.exe -s c1c6562 shell "pm install -r /data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk"
> info: Stopping logcat capture
> info: Logcat terminated with code null, signal SIGTERM
> info: Sent shutdown command, waiting for UiAutomator to stop...
> warn: UiAutomator did not shut down fast enough, calling it gone
> info: Cleaning up android objects
> info: Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: Remote install failed: pkg: /data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk
> Failure
> info: Error: Remote install failed: pkg: /data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk
报错> error: Failed to start an Appium session, err was: Error: Remote install failed: pkg: /data/local/tmp/c60364d78e47cc740796791b468ff7cb.apk
>
怎么解决?求助 检查APK包的路劲 名称 有没有编写正确,错误是远程安装失败 lin0731032 发表于 2016-3-21 16:54
检查APK包的路劲 名称 有没有编写正确,错误是远程安装失败
有apk的包,在apps目录的下面;代码如下:
package com.logingl.demo;
import io.appium.java_client.AppiumDriver;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.io.File;
import java.net.URL;
import java.util.List;
public class glvipbeta {
private AppiumDriver driver;
@Before
public void setUp() throws Exception {
//设置apk的路径
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "apps");
File app = new File(appDir, "glvip20160317beta.apk");
//设置自动化相关参数
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Coolpad 5952");
//设置安卓系统版本
capabilities.setCapability("platformVersion", "4.3");
//设置apk路径
capabilities.setCapability("app", app.getAbsolutePath());
//设置app的主包名和主类名
capabilities.setCapability("appPackage", "com.example.android.glvip20160317beta");
capabilities.setCapability("appActivity", ".glvip20160317beta");
//初始化
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
@Test
public void addContact(){
WebElement el = driver.findElement(By.name("App to the happy life of the client"));
el.click();
List<WebElement> buttonList = driver.findElementsByClassName("button");
buttonList.get(0).sendKeys("我的");
buttonList.get(1).sendKeys("设置");
buttonList.get(2).sendKeys("修改密码");
List<WebElement> textFieldsList = driver.findElementsByClassName("textfield");
textFieldsList.get(0).sendKeys("558942");
textFieldsList.get(1).sendKeys("196532");
textFieldsList.get(2).sendKeys("196532");
driver.findElementByName("Save").click();
}
@After
public void tearDown() throws Exception {
driver.quit();
}
}
烦请看看哪里出问题了
謝謝,希望以後多些 好好看看,非常好的帖子
页:
[1]