question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[UiAutomator2] Problem. Can't run tests

See original GitHub issue

The problem

For the past few days i tried to run tests with appium, plot twist, it didn’t work. On my previous project UiAutomator(1) did run well. I tried everything, please help :<

Environment

  • Appium v1.11.1
  • Ubuntu 18.04
  • Node.js v8.15.1
  • Npm
  • Nexus_6_API_28
  • Emulator
  • Appium CLI Edit. Same on Appium Desktop

Details

I can’t run UiAutomator 2. Tried running: appium, sudo appium and sudo -E appium.

Link to Appium logs

https://gist.github.com/S-Borkowski/05c40fa94c40a2ea0f706ca184386c21

Code To Reproduce Issue

    public void setUpBrowser() {
        dc = new DesiredCapabilities();
        dc.setCapability("deviceName",
                "Android_SDK_built_for_x86");
        //dc.setCapability("app",
        //        "/resources/base.apk");
        dc.setCapability("platformName",
                "Android");
        dc.setCapability("automationName",
                "UiAutomator2");
        dc.setCapability("appPackage",
                "com.company.project");
    }

    public void setUpMethod() {
        dc.setCapability("appActivity",
                "com.company.project." + activity);
        try {
            driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), dc);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        softAssert = new SoftAssert();
    }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:21 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
S-Borkowskicommented, Mar 20, 2019

You could update your installation guide 😉

0reactions
john-kheircommented, Aug 29, 2019

Had the same exact issue on Ubuntu 18.04. Installing appium --unsafe-perms definitely did the trick

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to run tests in android emulator. ([uiautomator2 ...
Hello I have created an emulator and launched it with AVD manager step in bitrise. When i try to run the appium scripts,...
Read more >
Appium-UIAutomator2-Java: the same code works directly ...
When I'm using the same code in a PO model function, one element cannot be located and the test fails. I have no...
Read more >
Can't run tests unless I restart io.appium.settings - Issues/Bugs
So I have this problem where I can not start my app, unless I kill io.appium.settings in adb. How it woks is: The...
Read more >
error:'*****' cannot be proxied to UiAutomator2 server because ...
This error may appear when acquiring a capture or running a test. First, try the following: Run the test again Relaunch device Delete......
Read more >
Write automated tests with UI Automator - Android Developers
The UI Automator testing framework provides a UiDevice class to access and perform operations on the device on which the target app is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found