简体   繁体   中英

Getting The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin when i merged branch

I am getting below error only when I try to merge my branch with the main branch in my project.

The SourceSet 'instrumentTest' is not recognized by the Android Gradle Plugin.

And when I reset my branch to the last commit, it works.

This was happening in Android Studio Version 3.1.2 and it's still there in current version 3.2 also.

This issue has already taken a lot of my time.

I tried to fix it by replacing instrumentTest with androidTest answered here but it's not working for me.

在此处输入图片说明

This error leads to the above Unable to resolve dependency errors

Thanks in advance.

Somehow, I found the answer to this problem.

After reading the errors carefully, I came to know that the problem is there in my lib module. And the error was not actually the one mentioned in Title .

Then I did below changes in the code.

I tried upgrating gradle version from 3.2.0 to 3.3.0-alpha13 and gradle distribution version from 4.6 to 4.10.1 in gradle-wrapper.properties .

Earlier my lib/build.gradle containing only release buildType . So I added same buildTypes which were in app/build.gradle .

Now my lib/build.gradle and app/build.gradle have same buildTypes

lib/build.gradle 在此处输入图片说明

app/build.gradle 在此处输入图片说明

And after syncing & building the project, I got rid of these errors(errors from image; Unable to resolve dependency ).

Hope this will help someone. Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM