Ionic diagnostic plugin error when building in Phonegap build

I am trying to ask the user permission before accessing their camera. I use the ionic diagnostic plugin for this. The app builds fine on Phonegap build before adding the diagnostic plugin. After adding plugin I get the following error through Phonegap build:

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ‘:processDebugManifest’.
Manifest merger failed : Attribute value=(26.0.0-alpha1) from [] AndroidManifest.xml:27:9-38 is also present at [] AndroidManifest.xml:27:9-31 value=(25.3.1). Suggestion: add ‘tools:replace=“android:value”’ to element at AndroidManifest.xml:25:5-27:41 to override

I installed the plugin using the following:

$ ionic cordova plugin add cordova.plugins.diagnostic
$ npm install --save @ionic-native/diagnostic

And in my config.xml I have the following:

<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="23" />

<plugin name="cordova.plugins.diagnostic" spec="^3.6.5"/>

Does anyone have an idea as to what I’m doing wrong here?

The diagnostic plugin is clashing with another one you are using. Searching for parts of the error message will show you that currently quite some users have this problem, also while building locally.

Write this is in build.gradle

configurations.all {    
  resolutionStrategy.eachDependency { 
    DependencyResolveDetails details -> 
       def requested = details.requested
        if ( == '') {
            if (!"multidex")) {
                details.useVersion '25.3.0'            }        

@Sujan12 Yes I think this is a clash with some other plugin. I have tried adding the diagnostic plugin to a brand new project and tried building. That worked fine.

@dgaurav I tried adding that code in platforms/android/build.gradle. Still gives the same error unfortunately.

I’m not very familiar with the gradle. Can this be written anywhere in the file? I’m guessing indentation does not matter.

(He just didn’t format the text as code. I fixed that, not the indentation is correct.)

I know this didn’t work for @Mcflurry81160, but strangely enough this worked for me. Maybe because beforehand, I also ran this command kind of as a safety net:

 npm uninstall --save @ionic-native/core
 npm install --save @ionic-native/core@latest
1 Like

Yay. Please post a link and a description of what exactly you did in your original topic for safe-keeping and future users.

1 Like

yes you can write anywhere is file but i suggest it at bottom.