【问题标题】:Execution failed for task ':app:dexDebug' when I add Google Cloud Module添加谷歌云模块时任务':app:dexDebug'执行失败
【发布时间】:2015-10-22 18:25:21
【问题描述】:

克隆项目https://github.com/googlesamples/google-services/tree/master/android/gcm,一切正常。

当我尝试使用向导添加模块“App Engine Backend with Google Cloud Messaging”时,我收到以下错误:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.transform.api.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

现在我尝试在我的 build.gradle defaultConfig 中添加它

multiDexEnabled true 

并清理项目并重新编译。但我总是得到同样的错误。最后我尝试从项目中删除表单(想恢复正常功能)但我收到以下错误:

    Installing gcm.play.android.samples.com.gcmquickstart
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/gcm.play.android.samples.com.gcmquickstart"
    pkg: /data/local/tmp/gcm.play.android.samples.com.gcmquickstart
Failure [INSTALL_FAILED_DUPLICATE_PERMISSION perm=com.example.gcm.permission.C2D_MESSAGE pkg=it.elipse.tnttrackingapp]


DEVICE SHELL COMMAND: pm uninstall gcm.play.android.samples.com.gcmquickstart
DELETE_FAILED_INTERNAL_ERROR

有人可以帮我吗?你会采取与我的情况相同的步骤吗?提前谢谢你

【问题讨论】:

    标签: android google-app-engine android-studio


    【解决方案1】:

    已解决

    大家好,我自己找到了答案。我希望它可以对有同样问题的人有所帮助。 当 Android Studio 生成后端模块时,在 build.gradle(Module:app) 的依赖项末尾添加这一行

    compile project(path: ':backend', configuration: 'android-endpoints')
    

    你有这样的东西:

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.1.0'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:palette-v7:23.0.1'
    compile 'com.android.support:cardview-v7:23.0.1'
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.google.android.gms:play-services-gcm:8.1.0'
    compile project(path: ':backend', configuration: 'android-endpoints')
    
    }
    

    解决方法是将自动生成的行移到依赖声明的顶部,如下所示:

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile project(path: ':backend', configuration: 'android-endpoints')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.1.0'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:palette-v7:23.0.1'
    compile 'com.android.support:cardview-v7:23.0.1'  
    compile 'com.android.support:support-v4:23.0.1'  
    compile 'com.google.android.gms:play-services-gcm:8.1.0'
    
    }
    

    更新

    如果不解决试试:

    Build->Make Project
    Build->Make Module 'app'
    Build->Clean Project
    Build->Rebuild Project
    

    【讨论】:

    • 嘿,伙计,我遇到了与 urs 相同的问题,但你的解决方案对我不起作用我没有添加 aby 库我只是修改了一些类你知道如何解决这个问题吗?
    • 您编辑了哪些课程?尝试发布您的 gradle 文件以尝试一起解决它
    • 感谢@Federico 的回复,我在这里发布了一个问题,请查看stackoverflow.com/questions/34068676/…
    • 两个都试过了,但都没有运气...... =(今年早些时候它工作了,但现在它是一个问题。
    • MicroR 你看到我的更新了吗?尝试发布您的代码
    猜你喜欢
    • 1970-01-01
    • 2015-07-16
    • 2023-03-23
    • 1970-01-01
    • 2016-12-13
    • 2015-05-16
    • 1970-01-01
    相关资源
    最近更新 更多