Comments (17)
Please step through each step carefully and in order. Allow each one time to build before going to the next:
(1) Delete your current project folder and create a new clone of the AdvancedAndroid_TeaTime repository and open the branch you are on.
(2) Do not upgrade your gradle version, click on 'do not remind me again for this project'
(3) Add these dependencies to your app level 'build.gradle' file:
compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test:runner:0.5'
(4) Add this to your app level 'build.gradle' file outside of any brackets:
configurations.all {
resolutionStrategy {
forcedModules = ['com.android.support:support-annotations:25.1.0']
}
}
(5) Add maven.google repository in your project level build.gradle file:
example:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
(6) Rebuild the project
(7) Under the gradle menu on the right expand 'AdvancedAndroid_TeaTime(root)' and under Tasks > build, click on assembleAndroidTest
(8) Try to add AndroidJUnit4.class to a test class.
from advancedandroid_teatime.
I found it. All I had to do was running the tests. Sorry, my bad.
from advancedandroid_teatime.
Got the same error.
Adding in app
's build.gradle
the following worked for me:
testCompile 'com.android.support.test:rules:1.0.1'
testCompile 'com.android.support.test:runner:1.0.1'
but still, I'm not able to run the test. Even though I upgraded all dependencies to the latest.
from advancedandroid_teatime.
Exactly, steps followed by @stevenberdak is already done and if you see AndroidJUnit4 error, just click on the green play button on left of public class IdlingResourceMenuActivityTest
and it works after it installs itself on your phone :)
from advancedandroid_teatime.
@stevenberdak
Thank you! you're a life Saver. 👍
from advancedandroid_teatime.
@stevenberdak Thank you so much for the solution. Works perfectly. Had I not found this, I was on the verge of re-installing Android Studio itself!
from advancedandroid_teatime.
from advancedandroid_teatime.
Just a quick update, the above instructions seems to work well but you can also try this if you like:
https://gwgnanodegrees.slack.com/archives/CB5HPB7G8/p1531768330000478
Pedram [12:12 PM]
commented on Rakesh Praneeth K(AND)’s file Espresso Errors.png
I had the same problem and I was able to fix it by adding these to my app build.gradle. Note the exclude group.
Pedram [12:12 PM]
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner :1.0.2'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
from advancedandroid_teatime.
still not working
from advancedandroid_teatime.
same here --> it's not working
from advancedandroid_teatime.
Did you start from a fresh clone?
from advancedandroid_teatime.
Waheguru ji
Works great!
from advancedandroid_teatime.
@stevenberdak Thanks a lot! I lost my patience on this problem for the last two days. You are my saviour!!!
from advancedandroid_teatime.
@stevenberdak please could you explain this step i cant understand it
(7) Under the gradle menu on the right expand 'AdvancedAndroid_TeaTime(root)' and under Tasks > build, click on assembleAndroidTest
from advancedandroid_teatime.
I haven't used Android Studio in awhile as I do web dev now, and I also know Android Studio has had updates but... There was a Gradle menu that popped out from the right side of the screen with Gradle tasks. It should be somewhere in the program if it is no longer there... and you would click on the task mentioned above (assembleAndroidTest) to trigger Gradle to perform the task which would complete the step. Hope this helps!
from advancedandroid_teatime.
Currently (in the version androidx.test:runner:1.3.0
) androidx.test.runner.AndroidJUnit4
is deprecated and thus is recommended to use androidx.test.ext.junit.runners.AndroidJUnit4
instead.
In order to setup this dependency declare androidTestImplementation 'androidx.test.ext:junit:1.1.2'
.
You can also rely on the guide to set up a project with AndroidX Test.
from advancedandroid_teatime.
@filipebezerra I tried to apply your advice to a usual Android project and got an exception when ran tests:
Test running failed: Instrumentation run failed due to 'java.lang.NoSuchMethodException'
androidx.test.runner.AndroidJUnit4
is not deprecated. :)
from advancedandroid_teatime.
Related Issues (19)
- exercise-1, solution-1 issue HOT 6
- Hard Coded Initial Currency Format
- android.support.test.espresso.IdlingResourceTimeoutException: HOT 1
- Currency symbol system dependent HOT 1
- OutOfMemoryError because of loading large images OR too slow scrolling HOT 1
- Exercise 4 TODO 6 and 8 registerIdlingResources() and unregisterIdlingResources() are deprecated
- TESP.02-Solution-AddMenuActivityScreenTest error HOT 3
- TESP.02-Exercise-AddMenuActivityScreenTest TODO
- Gradle Dependancies in Android 3.1.3 HOT 4
- TESP.01-Exercise-FinishOrderActivityBasicTest - Bad logic in test
- TESP.04-Solution-AddIdlingResourceMenuActivityTest
- AndroidJUnit4 and ActivityTestRule are not recognized
- com.example.android.teatime E/art: Throwing OutOfMemoryError HOT 6
- Steps to Upgrade Gradle Version and Plugin to Your Latest Android Studio
- Cant build Exercise and Solution 4.
- TESP.02-Solution-AddMenuActivityScreenTest FAILS to pass tests HOT 1
- Move gradle dependencies to one of the first steps
- play-services-appindexing:9.8.0 is deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from advancedandroid_teatime.