加入播放服务库后的错误:“:应用程序:transformClassesWithJarMergingForDebug” [英] Error after adding play-services library : ':app:transformClassesWithJarMergingForDebug'
问题描述
我的项目是用这些库完美的工作包括:
//支持库
编译com.android.support:support-v4:23.1.0
编译com.android.support:appcompat-v7:23.1.0
编译com.android.support:cardview-v7:23.1.0
编译com.android.support:recyclerview-v7:23.1.0
// 其他的东西
编译com.jakewharton:奶油刀:7.0.1
编译com.squareup.picasso:毕加索:2.5.2
编译com.google code.gson:GSON:2.3
编译com.squareup.retrofit:改造:1.9.0
编译com.afollestad:材料对话框:0.7.8.1
编译com.jpardogo.materialtabstrip:库:1.1.0
编译com.melnykov:floatingactionbutton:1.3.0
编译COM code-troopers.betterpickers:库:2.0.0
编译com.loopj.android:android-async-http:1.4.9
编译com.squareup.okhttp:okhttp:2.5.0
编译com.facebook.fresco:壁画:0.7.0
现在我试图按照本教程:建立一个GCM客户端应用程序在Android
我添加
- 添加的依赖到项目的顶级的build.gradle:结果
类路径'com.google.gms:谷歌服务:1.4.0-β3
- 插件添加到您的应用程序级的build.gradle:结果
应用插件:'com.google.gms.google服务
块引用>然后我说:
编译com.google.android.gms:发挥服务:8.1.0
现在,当我尝试同步,清洁,或重建。摇篮显示我在成功完成。
以下错误:
当我尝试运行应用程序,然后选择设备。我得到这个错误:错误:执行失败的任务:应用程序:transformClassesWithJarMergingForDebug。
> com.android.build.transform.api.TransformException:java.util.zip.ZipException:重复的条目: android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl.class这是我的应用程序级的build.gradle的最后一个版本:
应用插件:'com.android.application
应用插件:'com.google.gms.google的服务。安卓{
packagingOptions {
排除META-INF /相关内容
排除META-INF / LICENSE
排除META-INF / LICENSE.TXT
排除META-INF / LICENSE.TXT
排除META-INF /注意事项
排除META-INF / NOTICE.txt
排除META-INF / notice.txt
排除META-INF / ASL2.0
排除META-INF /服务/ javax.annotation.processing.Processor
}
compileSdkVersion 23
buildToolsVersion23.0.0
defaultConfig {
的applicationIDcom.mbh.gcmTest
15的minSdkVersion
targetSdkVersion 23
版本code 12
的versionName1.2.2 //启用multidex支持。试图修复
multiDexEnabled真
}
lintOptions {
禁用InvalidPackage
}
buildTypes {
发布 {
minifyEnabled假
}
}
dexOptions {
preDexLibraries = FALSE
}
productFlavors {
}
}//编译文件树(包括:['的* .jar'],DIR:库)
// debugCompile'com.squareup.leakcanary:leakcanary-安卓1.3.1
// releaseCompile'com.squareup.leakcanary:leakcanary-Android的无操作:1.3.1
依赖{
提供'org.glassfish:javax.annotation中:10.0-B28 //支持库
编译com.android.support:support-v4:23.1.0
编译com.android.support:appcompat-v7:23.1.0
编译com.android.support:cardview-v7:23.1.0
编译com.android.support:recyclerview-v7:23.1.0 编译com.jakewharton:奶油刀:7.0.1
编译com.squareup.picasso:毕加索:2.5.2
编译com.google code.gson:GSON:2.3
编译com.squareup.retrofit:改造:1.9.0
编译com.afollestad:材料对话框:0.7.8.1
编译com.jpardogo.materialtabstrip:库:1.1.0
编译com.melnykov:floatingactionbutton:1.3.0
编译COM code-troopers.betterpickers:库:2.0.0
编译com.loopj.android:android-async-http:1.4.9
编译com.squareup.okhttp:okhttp:2.5.0
编译com.facebook.fresco:壁画:0.7.0 // FOR GCM
编译com.android.support:multidex:1.0.1
编译com.google.android.gms:播放服务:8.1.0
}试图通过@JBirdVegas提供了答案后,我得到这个错误:
错误:执行失败的任务:应用程序:transformClassesWithDexForDebug。
> com.android.build.transform.api.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'C:\\ Program Files文件\\的Java \\ jdk1.8.0_51 \\斌\\ java.exe的'非零退出值1结束这是gradle这个日志:
注:配置是指未知的方法'无效attachBaseContext(android.content.Context)'类'com.emse.emseportal3.App
注意:有1引用未知的类成员。
您应该检查错别字您的配置。
注:共有14个班尝试使用反射访问注释。
你应该考虑保持标注属性
(使用'-keepattributes *注释*')。
(http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
注:共有20个教学班试图访问使用反射一般的签名。
你应该考虑让签名属性
(使用'-keepattributes签名')。
(http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
注意:有3班试图访问使用反射封闭类。
你应该考虑保持内部类属性
(使用'-keepattributes InnerClasses')。
(http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
注:有以类或接口15悬而未决的动态引用。
您应该检查是否需要指定其他程序罐子。
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
注:有33个访问类成员通过内省的方式。
你应该考虑明确保持提到的类成员
(用-keep或-keepclassmembers')。
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
注意:你忽略所有的警告!
preparing输出罐子[D:\\EmseArge\\Mohamad\\Android\\EmsePortal2\\app\\build\\intermediates\\multi-dex\\debug\\componentClasses.jar]
从方案的jar复制的资源[D:\\EmseArge\\Mohamad\\Android\\EmsePortal2\\app\\build\\intermediates\\transforms\\CLASSES\\FULL_PROJECT\\jarMerging\\debug\\classes.jar]
:应用:transformClassesWithDexForDebug
未捕获的翻译错误:java.util.concurrent.ExecutionException:java.lang.OutOfMemoryError:超出GC开销限制
未捕获的翻译错误:java.util.concurrent.ExecutionException:java.lang.OutOfMemoryError:超出GC开销限制
未捕获的翻译错误:java.util.concurrent.ExecutionException:java.lang.OutOfMemoryError:超出GC开销限制
3个错误;中止
错误:执行失败的任务:应用程序:transformClassesWithDexForDebug。
> com.android.build.transform.api.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'C:\\ Program Files文件\\的Java \\ jdk1.8.0_51 \\斌\\ java.exe的'非零退出值1结束
资料:构建失败
解决方案看起来
播放服务
已经包含了支持-V4
。尝试从classpath中排除编译('com.google.android.gms:发挥服务:8.1.0'){
排除组:com.android.support',模块:支持-V4
}第二个错误是不同的。第一件事,不要使用
Java8
它不支持,而不是使用java7目录
还什么版本的Android的摇篮插件
您使用的?试用最新com.android.tools.build:gradle:1.4.0-beta4
也尽量不要使用最新的
播放服务
我遇到了一个问题,对编译8.1.0
但不7.8.0
My project was working perfectly with those libraries included:
// Support libraries compile 'com.android.support:support-v4:23.1.0' compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:cardview-v7:23.1.0' compile 'com.android.support:recyclerview-v7:23.1.0' // Other stuff compile 'com.jakewharton:butterknife:7.0.1' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.google.code.gson:gson:2.3' compile 'com.squareup.retrofit:retrofit:1.9.0' compile 'com.afollestad:material-dialogs:0.7.8.1' compile 'com.jpardogo.materialtabstrip:library:1.1.0' compile 'com.melnykov:floatingactionbutton:1.3.0' compile 'com.code-troopers.betterpickers:library:2.0.0' compile 'com.loopj.android:android-async-http:1.4.9' compile 'com.squareup.okhttp:okhttp:2.5.0' compile 'com.facebook.fresco:fresco:0.7.0'
now i tried to follow this tutorial: Set up a GCM Client App on Android
I added
- Add the dependency to your project's top-level build.gradle:
classpath 'com.google.gms:google-services:1.4.0-beta3'
- Add the plugin to your app-level build.gradle:
apply plugin: 'com.google.gms.google-services'
Then i added :
compile "com.google.android.gms:play-services:8.1.0"
Now when i try to sync, clean, or rebuild. Gradle shows me it is done successfully.
THE ERROR: When i try to run the app and choose device. I get this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl.class
This is the last version of my app-level build.gradle:
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/license.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/notice.txt' exclude 'META-INF/ASL2.0' exclude 'META-INF/services/javax.annotation.processing.Processor' } compileSdkVersion 23 buildToolsVersion "23.0.0" defaultConfig { applicationId "com.mbh.gcmTest" minSdkVersion 15 targetSdkVersion 23 versionCode 12 versionName "1.2.2" // Enabling multidex support. trying to fix multiDexEnabled true } lintOptions { disable 'InvalidPackage' } buildTypes { release { minifyEnabled false } } dexOptions { preDexLibraries = false } productFlavors { } } //compile fileTree(include: ['*.jar'], dir: 'libs') //debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' //releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' dependencies { provided 'org.glassfish:javax.annotation:10.0-b28' // Support Libraries compile 'com.android.support:support-v4:23.1.0' compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:cardview-v7:23.1.0' compile 'com.android.support:recyclerview-v7:23.1.0' compile 'com.jakewharton:butterknife:7.0.1' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.google.code.gson:gson:2.3' compile 'com.squareup.retrofit:retrofit:1.9.0' compile 'com.afollestad:material-dialogs:0.7.8.1' compile 'com.jpardogo.materialtabstrip:library:1.1.0' compile 'com.melnykov:floatingactionbutton:1.3.0' compile 'com.code-troopers.betterpickers:library:2.0.0' compile 'com.loopj.android:android-async-http:1.4.9' compile 'com.squareup.okhttp:okhttp:2.5.0' compile 'com.facebook.fresco:fresco:0.7.0' // FOR GCM compile 'com.android.support:multidex:1.0.1' compile 'com.google.android.gms:play-services:8.1.0' }
after trying the answer provided by @JBirdVegas I got this error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 1
this is gradle log:
Note: the configuration refers to the unknown method 'void attachBaseContext(android.content.Context)' in class 'com.emse.emseportal3.App' Note: there were 1 references to unknown class members. You should check your configuration for typos. Note: there were 14 classes trying to access annotations using reflection. You should consider keeping the annotation attributes (using '-keepattributes *Annotation*'). (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes) Note: there were 20 classes trying to access generic signatures using reflection. You should consider keeping the signature attributes (using '-keepattributes Signature'). (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes) Note: there were 3 classes trying to access enclosing classes using reflection. You should consider keeping the inner classes attributes (using '-keepattributes InnerClasses'). (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes) Note: there were 15 unresolved dynamic references to classes or interfaces. You should check if you need to specify additional program jars. (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass) Note: there were 33 accesses to class members by means of introspection. You should consider explicitly keeping the mentioned class members (using '-keep' or '-keepclassmembers'). (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember) Note: you're ignoring all warnings! Preparing output jar [D:\EmseArge\Mohamad\Android\EmsePortal2\app\build\intermediates\multi-dex\debug\componentClasses.jar] Copying resources from program jar [D:\EmseArge\Mohamad\Android\EmsePortal2\app\build\intermediates\transforms\CLASSES\FULL_PROJECT\jarMerging\debug\classes.jar] :app:transformClassesWithDexForDebug Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded 3 errors; aborting Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 1 Information:BUILD FAILED
解决方案Looks like
play-services
already containssupport-v4
. Try excluding it from the classpathcompile('com.google.android.gms:play-services:8.1.0') { exclude group: 'com.android.support', module: 'support-v4' }
The second error is different. First thing don't use
Java8
it's not supported instead useJava7
Also what version of theAndroid Gradle Plugin
are you using? Try the latestcom.android.tools.build:gradle:1.4.0-beta4
Also try not using the latest
play-services
I ran into an issue compiling against8.1.0
but not7.8.0
这篇关于加入播放服务库后的错误:“:应用程序:transformClassesWithJarMergingForDebug”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!