Build Error -Ionic Cordova fails for android [duplicate]

强颜欢笑 提交于 2019-12-05 04:18:33

I had to do the stuff of both the answers above:

In platforms/android/phonegap-plugin-barcodescanner:

Search for compile 'com.android.support:support-v4:+ and replace for compile 'com.android.support:support-v4:27+'.

In platforms/android:

Search for cordova.system.library.2=com.android.support:support-v4:+ and replace for cordova.system.library.2=com.android.support:support-v4:27.1.0.

Hope it helps.

Mine required a similar fix as above only it was in the de.appplant.cordova.plugin.local-notification plugin. I changed ‘com.android.support:support-v4:+’ to ‘com.android.support:support-v4:23+’ and then removed and added the android platform and it built. However, I had an extra brace '}' in my build-extras.gradle that had to be removed also.

Spencer Hehl

found this on the ionic forum https://forum.ionicframework.com/t/android-build-broken-after-gradle-dependencies-update-execution-failed-for-task-processdebugresources-com-android-ide-common-process-processexception-failed-to-execute-aapt/109982/134 the suggestion that worked for me was "I got it working, my issue was in the cordova-plugin-file-opener2.
Change com.android.support:support-v4:+ to com.android.support:support-v4:23+ in the plugin.xml for the cordova-plugin-file-opener2 in the plugins folder and the node_modules folder.
Then do the same in the project.properties in platforms/android.
My plugin however was the background-geolocation and actually i dont believe i had to make a fix in the project.properties for mine.

In my case, problem was in barcode scanner plug in. Removing and adding this plug in did not work, after all get it worked by changing 'com.android.support:support-v4:+' to 'com.android.support:support-v4:27+' in file 'platform/android/phonegap-plugin-barcodescanner/{projectName}-barcodescanner'. What I did not understand is project was working yesterday perfectly, what happened in 24 hours and this problem occured...

Had the same issue, what I did was following:

  1. Clear the build directory
    • cordova clean
  2. Add multiDexEnabled under android -> defaultConfig to the build.gradle file
    • "your project\platforms\android\app\build.gradle"
    • multiDexEnabled true
  3. Change dependencies for "com.android.support" within the build.gradle file
    • com.android.support:support-v4:+ => com.android.support:support-v4:23+
  4. Go through the plugins folder and look in all "plugins.xml" and replace:
    • com.android.support:support-v4:+ => com.android.support:support-v4:23+
  5. Change project.properties under "platforms\android\project.properties"
    • cordova.system.library.4=com.android.support:support-v4:23+
  6. Run "ionic cordova run build"

Unable to merge dex

Clean install

Wrong Namespace / Version

.

android {

    defaultConfig {
        multiDexEnabled true
        versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
        applicationId privateHelpers.extractStringFromManifest("package")

        if (cdvMinSdkVersion != null) {
            minSdkVersion cdvMinSdkVersion
        }
    }
}

I did not find "com.android.support:support-v4:+" in the indicated paths of the topics I searched for, as I tried lastly in all folders and found in

platforms/android/phonegap-plugin-barcodescanner.gradle

in my case the plugin was the barcodescanner, in yours may be another. then I followed the information and replaced with "'com.android.support:support-v4:27+" and it worked.

I was wondering if it was working perfectly yesterday, today I changed only one text and gave this error ... during the build I realized that some downloads occurred I believe that an update happened that caused this.

I was having the same problem out of the blue yesterday. It started randomly but from reading around, it looks like it is to do with an update as mentioned above by @cpro90. However, I tried and could not find where to make the necessary manual change.

Eventually I identified that the problem was being caused by my cordova-plugin-crosswalk-webview plugin. On Github, I found the issue on the plugin repro this morning and it had over 520 views by lunch.

@UNUMObile suggested the following in the build.gradle file to force an earlier version globally:

    configurations.all {
       resolutionStrategy.force 'com.android.support:support-v4:24.0.0'
    }

This worked immediately for me and may help others with other plugins that also have had their dependancy on 'com.android.support:support-4:<28. The new version 28 seems to be the issue.

Hope this helps someone move forward.

Replacing 'com.android.support:support-v4:+' and 'com.android.support:support-v4:27+' with fixed versions in the plugin.xml didn't work for us - cordova crosswalk updated at least one support library to version 28.0.0-alpha1 though.

Forcing a fixed version of the support library for each dependency could solve the problem in the end.

configurations.all {
resolutionStrategy {
    eachDependency { DependencyResolveDetails details ->
        if (details.requested.group == 'com.android.support') {
            details.useVersion "27.1.0"
        }
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!