I used the test recorder to create a simple UI Test. However when I run the test that was generated, I get an error
Error:(4, 37) error: package android.support.test.espresso does not exist
Error:(5, 33) error: package android.support.test.rule does not exist
Error:(6, 35) error: package android.support.test.runner does not exist
Error:(14, 20) error: package org.hamcrest does not exist
Error:(15, 20) error: package org.hamcrest does not exist
Error:(16, 20) error: package org.hamcrest does not exist
Error:(17, 25) error: package org.hamcrest.core does not exist
Error:(18, 17) error: package org.junit does not exist
Error:(19, 17) error: package org.junit does not exist
Error:(20, 24) error: package org.junit.runner does not exist
Error:(22, 44) error: package android.support.test.espresso does not exist
Error:(22, 1) error: static import only from classes and interfaces
Error:(23, 51) error: package android.support.test.espresso.action does not exist
Error:(23, 1) error: static import only from classes and interfaces
You get the idea. I don't see any warnings or errors in Android Studio until I try to run the test.
Does anyone have an idea of what may be the problem?
Did you add forget add espresso to your dependencies ?
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
Upon further inspection, similar issue found here:
https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=&id=98326
Their solution didn't work for me. Turns out that I head to exclude the test package from the java sourceset in the build.gradle.
sourceSets{
main {
java.srcDirs = ['src']
java.excludes = ['instrumentTest/**','test/**']
...
}
}
Related
Following the install instructions via fabric and doing everything via Android Studio but I'm getting the following errors
Error:(6, 39) error: package com.crashlytics.android.answers does not exist
Error:(26, 29) error: package io.fabric.sdk.android does not exist
Error:(66, 27) error: cannot find symbol class Answers
Error:(66, 5) error: cannot find symbol variable Fabric
I got it working by following the manual installation on the Fabric website.
I picked LoginActivity template from Android Studio and started working on it. When I tried to run the project it gave me following errors:
Error:(10, 37) error: cannot find symbol class GooglePlayServicesClient
Error:(12, 35) error: cannot find symbol class PlusClient
Error:(18, 44) error: package GooglePlayServicesClient does not exist
Error:(19, 33) error: package GooglePlayServicesClient does not exist
Error:(33, 13) error: cannot find symbol class PlusClient
Error:(276, 12) error: cannot find symbol class PlusClient
Error:(75, 31) error: package PlusClient does not exist
Error:(157, 65) error: package PlusClient does not exist
Error:(236, 5) error: method does not override or implement a method from a supertype
Attached is the screen shot for my Android Studio version and SDK downloaded on my machine.
I know that I need to migrate to Google API Client.
So my questions are:
Is there any document to do the same which provides step by step guide ?
Why default template provided with Android Studio are not working ?
When trying to compile, I get the following errors:
Error:(59, 13) error: cannot find symbol class InstanceID
Error:(59, 37) error: cannot find symbol variable InstanceID
Error:(60, 59) error: package R does not exist
Error:(61, 21) error: cannot find symbol variable GoogleCloudMessaging
Error:(88, 9) error: cannot find symbol variable LocalBroadcastManager
Error:(117, 9) error: cannot find symbol class GcmPubSub
Error:(117, 28) error: cannot find symbol variable GcmPubSub
This is in a module, which is compiled as dependent on play-services:
com.google.android.gms:play-services:7.8.0 compile
I have tried cleaning and building, invalidating the cache and restarting. What am I missing here? Why can't it find the play-services library?
I just downloaded the https://github.com/baugarten/Android-Image-Edit from git hub but when i import project i have a lot of errors.i think i should import the library's but i don't know which one
these are some errors
Error:(7, 27) error: package org.apache.sanselan does not exist
Error:(60, 22) error: package com.google.ads does not exist
Error:(136, 13) error: cannot find symbol class AdView
Error:(179, 40) error: package AdSize does not exist
Error:(666, 46) error: cannot find symbol variable ExifTagConstants
The errors like "cannot find symbol" is because this class is not found on your repository. Find and add them.
The errors like "...does not exist" is because you should import these libraries into your project.
I recently started using IntelliJ to build my android application project. I imported my sherlock library as a module and added the dependency to my project. However when I try to rebuild my project to check any errors I get a lines of 10 errors like this:
Error:(3, 17) java: package org.junit does not exist
Error:(4, 24) java: package org.junit.runner does not exist
Error:(5, 23) java: package org.robolectric does not exist
Error:(7, 38) java: package org.fest.assertions.api does not exist
Error:(7, 1) java: static import only from classes and interfaces
Error:(9, 2) java: cannot find symbol
symbol: class RunWith
Error:(11, 6) java: cannot find symbol
symbol: class Test
location: class com.actionbarsherlock.internal.ResourcesCompatTest
Error:(13, 20) java: cannot find symbol
symbol: method cleanActivityName(java.lang.String,java.lang.String)
location: class com.actionbarsherlock.internal.ResourcesCompatTest
Error:(15, 20) java: cannot find symbol
symbol: method cleanActivityName(java.lang.String,java.lang.String)
location: class com.actionbarsherlock.internal.ResourcesCompatTest
Error:(17, 19) java: cannot find symbol
symbol: method cleanActivityName(java.lang.String,java.lang.String)
location: class com.actionbarsherlock.internal.ResourcesCompatTest
looks like the junit.jar is missing in your classpath. Add it and it should work.
you can check if the plugin is installed if it is. it is just matter of adding it to class path you can do it automatically by selecting the junit word and then press on the inspection left side yellow bulb choose "add junit to classpath"
Adding below line in build.gradle solved the problem...
compile 'com.android.support.test:runner:0.5'