Skip to content
Advertisement

Appium ERROR dump failed because assets could not be loaded: Invalid file Support

I am using Linux and I want to write tests using Appium. At the moment I installed all required tools to run it (Node is installed not through brew install node, but using nvm install node). Appium is running on localhost (Welcome to Appium v1.4.6 info: Appium REST http interface listener started on 0.0.0.0:4723 info: Console LogLevel: debug)

My code: public class MyTestApp {

private AppiumDriver<AndroidElement> driver;

@Test
public void mytestapptest () throws MalformedURLException {

    File file = new File("/home/kacinauskasl/workspace/appiumTests/AppiumProject/apk/myapk.apk");

    DesiredCapabilities capability = new DesiredCapabilities();
    capability.setCapability("deviceName", "HTC");
    capability.setCapability("platformName", "Android");
    capability.setCapability("platformVersion", "5.0.2");
    capability.setCapability("app", file.getAbsolutePath());        

    driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capability);  

}

}

When i run it through TestNG or Junit, i get error:

warn: W/zipro ( 7260): Error opening archive /home/kacinauskasl/workspace/appiumTests/AppiummProject/apk/myapk.apk: Invalid file
ERROR: dump failed because assets could not be loaded

error: Problem parsing package and activity from manifest: Error: packageAndLaunchActivityFromManifest failed. Error: Command failed: /bin/sh -c /home/kacinauskasl/SDK/android-sdk-linux/build-tools/23.0.0-preview/aapt dump badging /home/kacinauskasl/workspace/appiumTests/AppiummProject/apk/myapk.apk
W/zipro ( 7260): Error opening archive /home/kacinauskasl/workspace/appiumTests/AppiummProject/apk/myapk.apk: Invalid file
ERROR: dump failed because assets could not be loaded

info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: packageAndLaunchActivityFromManifest failed. Error: Command failed: /bin/sh -c /home/kacinauskasl/SDK/android-sdk-linux/build-tools/23.0.0-preview/aapt dump badging /home/kacinauskasl/workspace/appiumTests/AppiummProject/apk/myapk.apk
W/zipro ( 7260): Error opening archive /home/kacinauskasl/workspace/appiumTests/AppiummProject/apk/myapk.apk: Invalid file
ERROR: dump failed because assets could not be loaded.

At the moment my goal is to launch App on AVD or real device.

I would greatly appreciate any help.

Advertisement

Answer

The problem was solved.

  1. Insert:

    capability.setCapability(“appPackage”, “com.my_package_name”); capability.setCapability(“appActivity”, “my_package_name”);

  2. Install App on AVD or real device.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement