任务':transformClassesWithDexForDebug'执行失败。 ionic3 / cordova6.3.0 /节点

时间:2018-03-22 07:31:57

标签: ionic3 cordova-android

使用以下配置获取错误构建失败。我已经在我的项目中安装了以下插件。我尝试了这两个链接,但它对我不起作用。 #1#2。 使用以下配置获取错误构建失败。我已经在我的项目中安装了以下插件。我尝试了这两个链接,但它对我不起作用。 #1#2。 使用以下配置获取错误构建失败。我已经在我的项目中安装了以下插件。我尝试了这两个链接,但它对我不起作用。 #1#2

任何人都可以指导我找到正确的解决方案吗?

控制台错误跟踪:

BUILD FAILED

Total time: 45.774 secs
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.pro
cess.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.
DexException: Multiple dex files define Landroid/support/v4/accessibilityservice
/AccessibilityServiceInfoCompat;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
(node:9988) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.pro
cess.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.
DexException: Multiple dex files define Landroid/support/v4/accessibilityservice
/AccessibilityServiceInfoCompat;

BuildConfig.java

/**
 * Automatically generated file. DO NOT MODIFY
 */
package org.apache.cordova;

public final class BuildConfig {
  public static final boolean DEBUG = Boolean.parseBoolean("true");
  public static final String APPLICATION_ID = "org.apache.cordova";
  public static final String BUILD_TYPE = "debug";
  public static final String FLAVOR = "";
  public static final int VERSION_CODE = 1;
  public static final String VERSION_NAME = "1.0";
}

在build config java文件中出错:

[Java] The declared package "org.apache.cordova" does not match the expected package "CordovaLib.build.generated.source.buildConfig.debug.org.apache.cordova"
card.io.cordova.mobilesdk 2.1.0 "CardIO"
com-badrit-base64 0.2.0 "Base64"
com.paypal.cordova.mobilesdk 3.5.0 "PayPalMobile"
com.synconset.imagepicker 2.1.10 "ImagePicker"
cordova-clipboard 1.1.1 "Clipboard"
cordova-plugin-advanced-http 1.11.0 "Advanced HTTP plugin"
cordova-plugin-android-support-v4 21.0.1 "Android Support v4"
cordova-plugin-app-update 1.5.2 "AppUpdate"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appminimize 1.0 "AppMinimize"
cordova-plugin-appversion 1.0.0 "App Version"
cordova-plugin-badge 0.8.7 "Badge"
cordova-plugin-camera 4.0.2 "Camera"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-facebook4 1.9.1 "Facebook Connect"
cordova-plugin-fcm 2.1.2 "FCMPlugin"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-filechooser 1.0.1 "File Chooser"
cordova-plugin-filepath 1.0.2 "FilePath"
cordova-plugin-filepicker 1.1.4 "File Picker"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googleplus 5.2.1 "Google SignIn"
cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.1 "StatusBar"
cordova-plugin-uniquedeviceid 1.3.2 "UniqueDeviceID"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.3.2 "SocialSharing"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"





>ionic info
cli packages: (C:\Users\UserXx\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.0.1
    Node              : v8.9.0
    npm               : 3.10.10
    OS                : Windows 8.1

Environment Variables:

    ANDROID_HOME : C:\Users\UserXx\android-sdks

Misc:

    backend : pro

1 个答案:

答案 0 :(得分:1)

尝试运行此命令,然后构建/运行离子项目。

cordova clean android

执行此命令后,应该成功构建/运行。