cordova-plugin-document-viewer icon indicating copy to clipboard operation
cordova-plugin-document-viewer copied to clipboard

:transformClassesWithDexForDebug Error ionic v1

Open Amit06 opened this issue 7 years ago • 18 comments

I am using this plugin in an ionic v1 app and this plugin also installs cordova-plugin-android-support-v4-jar 23.2.1 whic causes trouble and :transformClassesWithDexForDebug error occours

Execution failed for task ':transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

Amit06 avatar Jun 08 '17 02:06 Amit06

Issue may be caused by ionic or another plugin you use in your project. Does the issue persist if you remove all other plugins from your project (should be easy to test as its a compile/build time issue)?

I guess the error indicates to different versions of android-support-v4.jar. Sorry, but I don't have any experiences with ionic. Is anybody out there who knows how to deal with this?

regnete avatar Jun 08 '17 08:06 regnete

I also encountered this problem, but I use the ionic3。

compile - Classpath for compiling the main sources. +--- com.commit451:PhotoView:1.2.4 | --- com.android.support:support-v4:23.0.1 -> 26.0.0-alpha1 | +--- com.android.support:support-compat:26.0.0-alpha1 | | --- com.android.support:support-annotations:26.0.0-alpha1 | +--- com.android.support:support-media-compat:26.0.0-alpha1 | | +--- com.android.support:support-annotations:26.0.0-alpha1 | | --- com.android.support:support-compat:26.0.0-alpha1 () | +--- com.android.support:support-core-utils:26.0.0-alpha1 | | +--- com.android.support:support-annotations:26.0.0-alpha1 | | --- com.android.support:support-compat:26.0.0-alpha1 () | +--- com.android.support:support-core-ui:26.0.0-alpha1 | | +--- com.android.support:support-annotations:26.0.0-alpha1 | | --- com.android.support:support-compat:26.0.0-alpha1 () | --- com.android.support:support-fragment:26.0.0-alpha1 | +--- com.android.support:support-compat:26.0.0-alpha1 () | +--- com.android.support:support-core-ui:26.0.0-alpha1 () | --- com.android.support:support-core-utils:26.0.0-alpha1 () +--- com.squareup.picasso:picasso:2.5.2 +--- me.leolin:ShortcutBadger:1.1.17 +--- com.android.support:support-v4:+ -> 26.0.0-alpha1 () +--- :barcodescanner: --- com.android.support:support-v4:24.1.1+ -> 26.0.0-alpha1 ()

zhaosg avatar Jun 09 '17 05:06 zhaosg

After installing this plugin i get the following but when i uninstall the plugin it hides :

Execution failed for task ':transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

GodsFavoriteDeveloper avatar Jun 12 '17 08:06 GodsFavoriteDeveloper

same problem here, any update?

cindyliu-yb avatar Jun 23 '17 11:06 cindyliu-yb

To fix this issue add the Android Support v4 plugin. ionic cordova plugin add cordova-plugin-android-support-v4-jar

GodsFavoriteDeveloper avatar Jun 23 '17 18:06 GodsFavoriteDeveloper

But this is what causing error .. adding this is causing problems in build

On 23-Jun-2017 11:45 PM, "Norman Dube" [email protected] wrote:

To fix this issue add the Android Support v4 plugin. ionic cordova plugin add cordova-plugin-android-support-v4-jar

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sitewaerts/cordova-plugin-document-viewer/issues/70#issuecomment-310736869, or mute the thread https://github.com/notifications/unsubscribe-auth/AKaTySPIrKvWIxHaQJtASVzB_piFmURiks5sHADIgaJpZM4NzfiA .

Amit06 avatar Jun 24 '17 05:06 Amit06

Same, issue. Any progress? @regnete why is the android-support-v4-jar plugin needed to begin with?

KholofeloMoyaba avatar Jul 03 '17 23:07 KholofeloMoyaba

exactly the same issue.

any updates?

lordgreg avatar Jul 10 '17 12:07 lordgreg

Same issue with ionic3 ... @regnete can you do something for us please ? It's a major bug ... Thanks in advance for your help !

bethany77 avatar Jul 11 '17 15:07 bethany77

sorry to all of you. I don't have any experiences with ionic. anybody out there to fix this?

regnete avatar Jul 11 '17 15:07 regnete

This isn't actually an Ionic issue at all. Having a android platform created by cordova, using this plugin, the app start fails. Even if opening whole platform android folder in Android Studio, it crashes with the exact same issue.

I'll try to find something out. But... is there a reason to use the support library at all?

lordgreg avatar Jul 12 '17 12:07 lordgreg

I thought it is needed for accessibg the files via content provider api.

regnete avatar Jul 12 '17 12:07 regnete

Same problem, would love to still use the plugin but I can't with cordova

mfossel avatar Jul 17 '17 20:07 mfossel

@mfossel and others..

I've made a fork (https://github.com/lordgreg/cordova-plugin-document-viewer/commit/bf498eb414c2a2226b6cfe3942297e78cf45a8ee) with nothing else than commenting the dependancy out of plugin.xml. Even without the dependency, I didn't encountered any crashes since I'm always checking if my os is android, and if so... I use file opener plugin to open the file using native App.

lordgreg avatar Jul 17 '17 20:07 lordgreg

I released and published version 0.9.4 of this plugin a few minutes ago. It contains https://github.com/sitewaerts/cordova-plugin-document-viewer/pull/77 which should fix this issue.

Could anybody please confirm?

@mfossel : Your fork should be obsolete now.

Thx for your patience! And even more thx to @oddcb !

regnete avatar Jul 18 '17 06:07 regnete

Hi Everyone,

I run into this issue (Execution failed for task ':transformClassesWithDexForDebug' ) often, with a variety of plugins when working with ionic. Go into your platforms/android/build.gradle and change the default config from:

defaultConfig {
        versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
        applicationId privateHelpers.extractStringFromManifest("package")
        if (cdvMinSdkVersion != null) {
            minSdkVersion cdvMinSdkVersion
        }
    }

to:

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

        if (cdvMinSdkVersion != null) {
            minSdkVersion cdvMinSdkVersion
        }

        multiDexEnabled true
    }

What your doing is adding the multiDexEnabled true line after the if statement -- and your ionic project should build.

NOTE: You will have to do this every time you remove/readd your android platform folder.

Best of luck!

stacybrenes avatar Aug 03 '17 14:08 stacybrenes

I thought we fixed this issue. Does it still appear?

regnete avatar Aug 03 '17 18:08 regnete

@stacybrenes this is really a last-case scenario I would do. I'd rather stop using the plugin itself for a while than manually update the platform files.

But, however, this issue has been fixed with the latest version and should NOT appear anymore.

lordgreg avatar Aug 03 '17 18:08 lordgreg