Coder Social home page Coder Social logo

Comments (17)

stevenberdak avatar stevenberdak commented on June 16, 2024 30

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.

silentLOL avatar silentLOL commented on June 16, 2024 3

I found it. All I had to do was running the tests. Sorry, my bad.

from advancedandroid_teatime.

jppasa avatar jppasa commented on June 16, 2024 2

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.

DroidPulkit avatar DroidPulkit commented on June 16, 2024 2

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.

arrmixer avatar arrmixer commented on June 16, 2024 1

@stevenberdak
Thank you! you're a life Saver. 👍

from advancedandroid_teatime.

thekaranacharya avatar thekaranacharya commented on June 16, 2024 1

@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.

stevenberdak avatar stevenberdak commented on June 16, 2024

@ashu879 @jppasa

from advancedandroid_teatime.

stevenberdak avatar stevenberdak commented on June 16, 2024

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.

sidDarthVader31 avatar sidDarthVader31 commented on June 16, 2024

still not working

from advancedandroid_teatime.

silentLOL avatar silentLOL commented on June 16, 2024

same here --> it's not working

from advancedandroid_teatime.

stevenberdak avatar stevenberdak commented on June 16, 2024

Did you start from a fresh clone?

from advancedandroid_teatime.

cingh-jasdeep avatar cingh-jasdeep commented on June 16, 2024

Waheguru ji
Works great!

from advancedandroid_teatime.

nirmaljeffrey avatar nirmaljeffrey commented on June 16, 2024

@stevenberdak Thanks a lot! I lost my patience on this problem for the last two days. You are my saviour!!!

from advancedandroid_teatime.

wafaaHilmy avatar wafaaHilmy commented on June 16, 2024

@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.

stevenberdak avatar stevenberdak commented on June 16, 2024

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.

filipebezerra avatar filipebezerra commented on June 16, 2024

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.

CoolMind avatar CoolMind commented on June 16, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.