Error:Execution failed for task ':app:preDebugAndroidTestBuild' , when tried to run java program in android studio

后端 未结 14 1212
渐次进展
渐次进展 2021-02-13 03:03

Getting the below error at the time of running java program in android studio.

Error:Execution failed for task \':app:preDebugAndroidTestBuild\'.

<
14条回答
  •  终归单人心
    2021-02-13 03:36

    thanks to @Ganesh Bhat and Chad Bingham

    For those who still facing the problem, above answer did not help me in android studio 2.2 Preview.

    This fixed my issue.

    add this to your gradle file.

    configurations.all {
      resolutionStrategy {
        force 'com.android.support:support-annotations:23.1.1'
     }
    }
    

    Reference: https://github.com/JakeWharton/u2020/blob/05a57bf43b9b61f16d32cbe8717af77cd608b0fb/build.gradle#L136-L140

    Android support library error after updating to 23.3.0

    Resolved versions for app (22.0.0) and test app (21.0.3) differ


    update - if the previous answer doesn't work :

    you should update the compileSdkVersion and appcompat to the latest update till now compileSdkVersion is 27 , also appcompat is 27.1.1 and 28.0.0-alpha1 is a pre-release version

    thus

    change

    compileSdkVersion 27

    and

    implementation 'com.android.support:appcompat-v7:26.1.0'

    to latest update

    implementation 'com.android.support:appcompat-v7:27.1.1'

    you can check the latest updates from this link :

    https://developer.android.com/topic/libraries/support-library/revisions

提交回复
热议问题