简体   繁体   English

为Android Wear生成签名APK时出错

[英]Getting Error while generating signed apk for Android Wear

Getting bellow Error while generating signed APK for android wear. 在为Android Wear生成签名的APK时出现波纹管错误。

Error:Execution failed for task ':wear:transformClassesWithDexForRelease'.
> 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;

Although when I'm debugging, its running flawlessly in device or emulator. 尽管在调试时,它可以在设备或仿真器中完美运行。 But the above issue occurs every time I try to generate the signed APK for Android-Wear. 但是,每次我尝试为Android-Wear生成签名的APK时,都会发生上述问题。

The way I solved the issue I edited build.gradle file of both mobile and wear module. 解决问题的方式是我编辑了mobile和wear模块的build.gradle文件。 add " multiDexEnabled true " inside of defaultConfig{} of "build.gradle" file of both mobile and wear module. 在移动和磨损模块的“ build.gradle”文件的defaultConfig {}中添加“ multiDexEnabled true”。 samples are bellow. 样品在下面。

android {
    defaultConfig {
       ....
             multiDexEnabled true
        ...  
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM