Answer the question
In order to leave comments, you need to log in
What can cause the following errors when running tests in Android Studio?
Created a project - https://disk.yandex.ru/d/SaCLWyVX3wz6PA
Created a file in the com.example.myapplication(test) AppiumTest.java folder.
I wrote a test in it.
When executed, the following list of errors appears:
Executing tasks: [:app:generateDebugSources, :app:compileDebugSources, :app:createMockableJar, :app:compileDebugUnitTestSources] in project C:\Users\Alex\Desktop\MyApplication
AGPBI: {"kind":"warning","text":"Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.\nThis repository is deprecated and it will be shut down in the future.\nSee http://developer.android.com/r/tools/jcenter-end-of-service for more information.\nCurrently detected usages in: root project 'My Application', project ':app'","sources":[{}]}
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:compileLintChecks UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:checkDebugAarMetadata UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:extractDeepLinksDebug UP-TO-DATE
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:createMockableJar UP-TO-DATE
> Task :app:preDebugUnitTestBuild UP-TO-DATE
> Task :app:javaPreCompileDebugUnitTest UP-TO-DATE
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:processDebugUnitTestJavaRes NO-SOURCE
> Task :app:processDebugManifestForPackage
> Task :app:processDebugResources
> Task :app:compileDebugJavaWithJavac UP-TO-DATE
> Task :app:compileDebugSources UP-TO-DATE
> Task :app:bundleDebugClasses UP-TO-DATE
> Task :app:compileDebugUnitTestJavaWithJavac FAILED
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:7: error: cannot find symbol
import org.openqa.selenium.By;
^
symbol: class By
location: package org.openqa.selenium
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:8: error: package org.openqa.selenium.remote does not exist
import org.openqa.selenium.remote.DesiredCapabilities;
^
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:17: error: cannot find symbol
AndridDriver driver;
^
symbol: class AndridDriver
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:22: error: cannot find symbol
DesiredCapabilities capabilities = new DesiredCapabilities();
^
symbol: class DesiredCapabilities
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:22: error: cannot find symbol
DesiredCapabilities capabilities = new DesiredCapabilities();
^
symbol: class DesiredCapabilities
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:33: error: cannot access HttpClient
driver = new AndroidDriver (new URL("http://192.168.0.169:4444/wd/hub"), capabilities);
^
class file for org.openqa.selenium.remote.http.HttpClient not found
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:44: error: cannot find symbol
driver.rotate(ScreenOrientation.LANDSCAPE);
^
symbol: variable ScreenOrientation
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:45: error: cannot find symbol
driver.findElement(By.xpath("//android.widget.EditText[@index='1']")).sendKeys("2");
^
symbol: method xpath(String)
location: class By
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:46: error: cannot find symbol
driver.findElement(By.xpath("//android.widget.EditText[@index='3']")).sendKeys("3");
^
symbol: method xpath(String)
location: class By
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:47: error: cannot find symbol
driver.findElement(By.xpath("//android.widget.Button[@index='4']")).click();
^
symbol: method xpath(String)
location: class By
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:48: error: cannot find symbol
driver.findElement(By.xpath("//android.widget.Button[@text='����������']")).click();
^
symbol: method xpath(String)
location: class By
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:49: error: cannot find symbol
String result = driver.findElement(By.xpath("//android.widget.TextView[@index='5']")).getText();
^
symbol: method xpath(String)
location: class By
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:60: error: cannot find symbol
int rotate = getWindowManager().getDefaultDisplay().getRotation();
^
symbol: method getWindowManager()
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:62: error: cannot find symbol
case Surface.ROTATION_0:
^
symbol: variable Surface
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:64: error: cannot find symbol
case Surface.ROTATION_90:
^
symbol: variable Surface
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:66: error: cannot find symbol
case Surface.ROTATION_180:
^
symbol: variable Surface
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
C:\Users\Alex\Desktop\MyApplication\app\src\test\java\com\example\myapplication\AppiumTest.java:68: error: cannot find symbol
case Surface.ROTATION_270:
^
symbol: variable Surface
location: class AppiumTest<android,xmlns>
where android,xmlns are type-variables:
android extends Object declared in class AppiumTest
xmlns extends Object declared in class AppiumTest
17 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugUnitTestJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
15 actionable tasks: 5 executed, 10 up-to-date
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question