Skip to content

Instantly share code, notes, and snippets.

@danhantao
Last active August 29, 2015 14:01
Show Gist options
  • Save danhantao/29fedc55a2120ab32b82 to your computer and use it in GitHub Desktop.
Save danhantao/29fedc55a2120ab32b82 to your computer and use it in GitHub Desktop.
https://github.com/roboguice/roboguice/wiki/CustomBinding
https://github.com/goodow/realtime-android/blob/v0.3.0/src/main/java/com/goodow/realtime/android/RealtimeApplication.java
https://github.com/goodow/drive-android/blob/v0.3.x/res/values/roboguice.xml
https://github.com/roboguice/roboguice
guice注入的三种方式
#http://book.51cto.com/art/200811/97246.htm
#http://dreamzhong.iteye.com/blog/1139484
http://dreamzhong.iteye.com/blog/1141335
Module module = new DatabaseModule();
Injector injector = Guice.createInjector(module);
Database instance1 = injector.getInstance(Database.class);
#guice的单例
http://fansofjava.iteye.com/blog/397513
this.bind(Service.class).to(ServiceImp.class).in(Scopes.SINGLETON);
this.bind(Service.class).to(ServiceImp.class).asEagerSingleton()
this.bind(Service.class).to(ServiceImp.class).in(Singleton.class)
aar:其中的assets目录中的内容,需要手动的拷贝。
其中,Manifest.xml中的文件,需要手动的配置清单文件。无法自动的合并。
1.用命令行打包,运行
mvn clean package android:deploy android:run
合并asset目录。
2.直接用idea运行,不能合并asset目录。
不管怎么运行,如果不手动的在manifest.xml里面注册activity,会报如下异常:
Unable to find explicit activity class {com.jayway.maven.plugins.android.generation2.samples.libraryprojects.mainapp/com.jayway.maven.plugins.android.generation2.samples.libraryprojects.aar1.AbstractActivityUsingResources}; have you declared this activity in your AndroidManifest.xml
# http://stackoverflow.com/questions/22622952/add-sibling-project-resources-to-android-assets-without-tight-coupling
https://github.com/roboguice/roboguice/blob/b78ce0f5874112700c6ceb8748e1a4b5eca0db70/roboguice/src/main/java/roboguice/RoboGuice.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment