Can't build unit tests after upgrade to AGP 4.2
See original GitHub issueAndroid Studio 4.2.1 AGP 4.2.1 Gradle 6.7.1 AppAuth 0.8.1.1
After upgrade to AGP 4.2.1 I’m getting error
Manifest merger failed : Attribute data@scheme at manifestMerger17575735412594745234.xml requires a placeholder substitution but no value for <appAuthRedirectScheme> is provided.
when I’m trying build unit tests. For normal build it’s working.
I have multi-module project and in my app module, there is AndroidManifest.xml:
<activity
android:name="net.openid.appauth.RedirectUriReceiverActivity"
tools:node="replace">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="identity"
android:scheme="xxx" />
</intent-filter>
</activity>
In AppAuth module, there is test/AndroidManifest.xml:
<activity
android:name="net.openid.appauth.RedirectUriReceiverActivity"
tools:node="replace" />
And in build.gradle (app) I have:
unitTestVariants.all {
it.mergedFlavor.manifestPlaceholders += [
appAuthRedirectScheme: "xxx"
]
}
It worked fine until the upgrade. Probably “unitTestVariants” stopped working? Is there any alternative way?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:11
Top Results From Across the Web
Upgrade to AGP 4.2.0 ,unable to generate Jacoco code ...
I was having the same problem after upgrading to 4.2.1. It looks like the Jacoco execution data file for non-instrumented unit tests has ......
Read more >Known issues with Android Studio and Android Gradle Plugin
Workaround 1: Run the Gradle check task from the IDE rather than running a unit test. Workaround 2: Update your build script to...
Read more >AGP 7.0.0 does not create unit test jacoco exec files correctly ...
The first comment in this issue #1 perfectly describes the issue: the coverage file is literally empty. Again: I only see this happening...
Read more >Upgrading your build from Gradle 7.x to the latest
For example, build scripts that previously added Test Suite dependencies with the ... Dependency): Unit defined in org.gradle.kotlin.dsl public operator fun ...
Read more >AGP 7.0: Next major release for the Android Gradle plugin
In fact, in AGP 4.2 some of these APIs have changed. ... to allow separate blocks for UnitTests ( beforeUnitTest and unitTest )...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@agologan I didn’t even need to add it to tests. In
<module>/src/AndroidManifest.xml
it is enough. test and AndroidTest use it as fallback. @vramasam The point is that we want every module except the main module (app module) don’t see appAuthRedirectScheme so when we have for example this module hierarchywe have to add empty replacement to modules B and E so every module above them (for example A) get empty RedirectUriReceiverActivity in manifest merger and only in app module add AndroidManifest with final android:host and android:scheme.
Closing this as there has been no response from the OP in a reasonable amount of time. Assuming issue has been resolved. Feel free to open a new issue if you require further assistance 👍