离子cordova构建android多个dex文件错误

时间:2017-07-18 14:39:50

标签: android cordova ionic-framework ionic2

我正在尝试使用Ionic构建应用程序,当我执行

  

离子cordova构建android

此外,我尝试了所有可能的方法来解决堆栈溢出下列出的这个问题,而离题论坛仍然存在同样的问题

我收到如下错误。但是如果我执行离子cordova构建ios,相同的代码工作正常

我正在使用以下插件

<plugin name="cordova-plugin-console" spec="^1.0.7" />
    <plugin name="cordova-plugin-device" spec="^1.1.6" />
    <plugin name="cordova-plugin-document-viewer" spec="^0.9.3" />
    <plugin name="cordova-plugin-file-opener2" spec="^2.0.19" />
    <plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
    <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
    <plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />

错误讯息:

  

✖运行命令 - 失败!

     

[错误] Cordova遇到错误。           您可以通过直接运行上面的Cordova命令获得更多洞察力。

     

[错误]运行cordova build android时出错(退出   代码1):

    (truncated) ... :generateDebugResValues
    :CordovaLib:generateDebugResources
    :CordovaLib:packageDebugResources
    :CordovaLib:processDebugManifest
    :CordovaLib:generateDebugBuildConfig
    :CordovaLib:processDebugResources
    :CordovaLib:generateDebugSources
    :CordovaLib:incrementalDebugJavaCompilationSafeguard
    :CordovaLib:compileDebugJavaWithJavac
    :CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution,
    etc.).
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    :CordovaLib:processDebugJavaRes UP-TO-DATE
    :CordovaLib:transformResourcesWithMergeJavaResForDebug
    :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
    :CordovaLib:mergeDebugJniLibFolders
    :CordovaLib:transformNative_libsWithMergeJniLibsForDebug
    :CordovaLib:transformNative_libsWithSyncJniLibsForDebug
    :CordovaLib:bundleDebug
    :CordovaLib:preReleaseBuild UP-TO-DATE
    :CordovaLib:checkReleaseManifest
    :CordovaLib:prepareReleaseDependencies
    :CordovaLib:compileReleaseAidl
    :CordovaLib:compileReleaseNdk UP-TO-DATE
    :CordovaLib:copyReleaseLint UP-TO-DATE
    :CordovaLib:mergeReleaseShaders
    :CordovaLib:compileReleaseShaders
    :CordovaLib:generateReleaseAssets
    :CordovaLib:mergeReleaseAssets
    :CordovaLib:mergeReleaseProguardFiles
    :CordovaLib:packageReleaseRenderscript UP-TO-DATE
    :CordovaLib:compileReleaseRenderscript
    :CordovaLib:generateReleaseResValues
    :CordovaLib:generateReleaseResources
    :CordovaLib:packageReleaseResources
    :CordovaLib:processReleaseManifest
    :CordovaLib:generateReleaseBuildConfig
    :CordovaLib:processReleaseResources
    :CordovaLib:generateReleaseSources
    :CordovaLib:incrementalReleaseJavaCompilationSafeguard
    :CordovaLib:compileReleaseJavaWithJavac
    :CordovaLib:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution,
    etc.).
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    :CordovaLib:processReleaseJavaRes UP-TO-DATE
    :CordovaLib:transformResourcesWithMergeJavaResForRelease
    :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
    :CordovaLib:mergeReleaseJniLibFolders
    :CordovaLib:transformNative_libsWithMergeJniLibsForRelease
    :CordovaLib:transformNative_libsWithSyncJniLibsForRelease
    :CordovaLib:bundleRelease
    :prepareBarcodescannerLibrary
    :prepareComAndroidSupportSupportCompat2600Alpha1Library
    :prepareComAndroidSupportSupportCoreUi2600Alpha1Library
    :prepareComAndroidSupportSupportCoreUtils2600Alpha1Library
    :prepareComAndroidSupportSupportFragment2600Alpha1Library
    :prepareComAndroidSupportSupportMediaCompat2600Alpha1Library
    :prepareComAndroidSupportSupportV42600Alpha1Library
    :prepareOrgApacheCordovaCordovaLib623DebugLibrary
    :prepareDebugDependencies
    :compileDebugAidl
    :compileDebugRenderscript
    :generateDebugBuildConfig
    :generateDebugResValues
    :generateDebugResources
    :mergeDebugResources
    :processDebugManifest
    :processDebugResources
    :generateDebugSources
    :incrementalDebugJavaCompilationSafeguard
    :compileDebugJavaWithJavac
    :compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    :compileDebugNdk UP-TO-DATE
    :compileDebugSources
    :mergeDebugShaders
    :compileDebugShaders
    :generateDebugAssets
    :mergeDebugAssets
    :transformClassesWithDexForDebug FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    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;

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

    Total time: 1 mins 16.804 secs
    Error: /Users/adithya/Desktop/mobile-app/eImpact/platforms/android/gradlew:
     

命令失败,退出代码为1           错误输出:           注意:某些输入文件使用或覆盖已弃用的API。           注意:使用-Xlint重新编译:弃用以获取详细信息。           注意:某些输入文件使用或覆盖已弃用的API。           注意:使用-Xlint重新编译:弃用以获取详细信息。           注意:某些输入文件使用或覆盖已弃用的API。           注意:使用-Xlint重新编译:弃用以获取详细信息。

    FAILURE: Build failed with an exception.

    * What went wrong:
    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;

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

我的依赖关系如下

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile(project(path: "CordovaLib", configuration: "debug"))
    releaseCompile(project(path: "CordovaLib", configuration: "release"))
    compile "com.android.support:support-v4:+"
    // SUB-PROJECT DEPENDENCIES END
}

是否有人有同样的问题,提前致谢

0 个答案:

没有答案