我正在关注Dagger2的示例TODO应用程序,但已包含OutOfMemoryError:已超出GC开销限制。随着600+警告喜欢:
警告:忽略InnerClasses属性为一个匿名内部类(org.eclipse.osgi.internal.baseadaptor.BaseStorage $ StateSaver $ 1),不带有关联的EnclosingMethod属性。这个类可能是由一个编译器生成的,它不针对现代的.class文件格式。推荐的解决方案是使用最新的编译器从源代码重新编译类,而不指定任何“-target”类型选项。忽略这个警告的结果是,对这个类的反射操作将错误地表明它不是内部类。
这里是我的代码:dagger2 cannot find symbol,我在gk5885的帮助下解决了以前的问题。再次感谢你:-)。
在我添加SharedPreferences sharedPreferences()
到NetComponent
并重建之后,程序编译了9分钟并最终抛出该错误。但编译我的应用程序的前一个版本的时间没有Dagger2是秒,因为我很确定Dagger2导致此错误。但我不知道为什么以及如何解决这个问题。
而我的VM尺寸:-Xms256m -Xmx1280m。我认为这已经足够了。
任何帮助表示赞赏。
编辑:事实上,在我重建之前,我有复制的文件复制在apk错误。我解决它在gradle这个补充一点:匕首2超出GC开销限制
packagingOptions {
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
也许我应该给我的依存关系:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'me.yokeyword:indexablestickylistview:0.6.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'in.srain.cube:ultra-ptr:1.0.11'
compile files('libs/ormlite-android-4.49-SNAPSHOT.jar')
compile files('libs/ormlite-core-4.49-SNAPSHOT.jar')
compile 'com.jakewharton:butterknife:8.1.0'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.google.dagger:dagger:2.2' // dagger2
compile 'com.google.dagger:dagger-compiler:2.2' // dagger2
compile project(':ToggleButtonLib')
compile project(':IMKit')
}
对不起,这么多的描述....
我也碰到过这个。我不记得确切无法保证它会工作,但尝试文件 - >无效缓存/重启 – Chisko
@Cheskos它不工作... – Antelope
我认为你将需要增加你的堆512或1024 – Chisko