roboguice

Gradle project does not build when I add RoboBlender

半城伤御伤魂 提交于 2019-12-14 03:52:04
问题 I have added RoboGuice 3 dependency into my gradle build file it compiles and runs, however the application crashes because of NoClassDefFoundError: AnnotationDatabaseImpl. Did some research that suggested that RoboBlender was necessary to generate the definition (I'm familiar with RoboGuice 2 which does not require RoboBlender) but when I add RoboBlender the project no longer builds. dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21

What is wrong with RoboGuice

纵饮孤独 提交于 2019-12-13 05:31:08
问题 I want to create a singleton object using RoboGuice but I get null exception. I don't know what is wrong with my codes. @Singleton public class SessionService { private static Session session; public Session getSession() { if (session == null){ session = new Session(); } return session; } } -- public class ChannelManager { @Inject SessionService sessionService; public String getName(){ return sessionService.getSession().getName(); } } public class MainActivity extends RoboActivity{

Android Roboguice not working with Proguard

家住魔仙堡 提交于 2019-12-12 06:14:26
问题 this is my proguard-project.txt: -keep class com.google.inject.** { *; } -keep class javax.inject.** { *; } -keep class javax.annotation.** { *; } -keep class roboguice.** { *; } -keepattributes Signature -keepattributes *Annotation* -keep class roboguice.** -keep class com.google.inject.** { *; } -keepclassmembers class * { @com.google.inject.Inject <fields>; @com.google.inject.Inject <init>(...); } -keep class javax.inject.** { *; } -keep class javax.annotation.** { *; } -keep class com

RoboGuice custom module application context

喜欢而已 提交于 2019-12-11 03:17:53
问题 How do I get the application context in my custom module? Here is the code for my module: public class MyModule extends AbstractModule { @Override @SuppressWarnings("unchecked") protected void configure() { // Package Info try { final PackageInfo info = application.getPackageManager().getPackageInfo( application.getPackageName(), PackageManager.GET_META_DATA); bind(PackageInfo.class).toInstance(info); } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException(e); } } } I am

Maven Eclipse Plugin won't add Android support-v4 to build path

倖福魔咒の 提交于 2019-12-10 19:55:27
问题 I'm working on a project using RoboGuice with Eclipse ADT, m2e and android-maven-plugin. I'm using RoboListFragment class which depends on android.support.v4.app.ListFragment, for this reason I've added the following dependency to pom.xml <dependency> <groupId>com.google.android</groupId> <artifactId>support-v4</artifactId> <version>r7</version> <scope>provided</scope> </dependency> Nevertheless eclipse does not add that library to build path. When I build my project from command line

onViewCreated with compatibility library

核能气质少年 提交于 2019-12-07 09:56:57
问题 In an Android application I have a fragment implemented that overrides onViewCreated to set up some OnClickListeners once the view is there. This all works fine when I implement. However as soon as I add the compatibility library v4 r3 it seems that the method is not called at all. For now I am migrating my setup into onResume but that is really not ideal. So here are my questions: Is this a bug in the compatibility library? Is there a better workaround? After some more digging and trying

Releasing ORMLite helper on @Singleton

大城市里の小女人 提交于 2019-12-07 07:23:51
问题 I have a @Singleton class where I've injected an instance of OrmLiteSqliteOpenHelper . Do I actually ever need to call the OpenHelperManager.releaseHelper() ? In case I do, where and how should it be done as the class doesn't extend any Android base class where I could get to the onDestroy ? 回答1: There is an ORMLite example Android project which demonstrates this called HelloAndroidNoBase. I'd check it out. The relevant code section from the main Activity is included below. You'll need to

Releasing ORMLite helper on @Singleton

守給你的承諾、 提交于 2019-12-05 13:22:43
I have a @Singleton class where I've injected an instance of OrmLiteSqliteOpenHelper . Do I actually ever need to call the OpenHelperManager.releaseHelper() ? In case I do, where and how should it be done as the class doesn't extend any Android base class where I could get to the onDestroy ? There is an ORMLite example Android project which demonstrates this called HelloAndroidNoBase . I'd check it out. The relevant code section from the main Activity is included below. You'll need to have this sort of code in each one of your Activity or other classes that uses the database. If your class

Android Roboguice Exception

旧巷老猫 提交于 2019-12-04 03:19:32
Just starting my way with Roboguice for android. Tried implementing this simple context injection but getting this exception. I googled it and ran into quite a few posts but non solved my issue. This is the exception below, any ideas? Thanks in advance 02-05 00:14:54.330: I/dalvikvm(777): Failed resolving Lcom/google/inject/Provider; interface 627 'Ljavax/inject/Provider;' 02-05 00:14:54.330: W/dalvikvm(777): Link of class 'Lcom/google/inject/Provider;' failed 02-05 00:14:54.340: I/dalvikvm(777): Failed resolving Lcom/google/inject/Provider; interface 627 'Ljavax/inject/Provider;' 02-05 00:14

java.io.FileNotFoundException: com/google/inject/internal/util/$Finalizer.class at the start of android app

。_饼干妹妹 提交于 2019-12-03 23:20:38
I'm developing and android countdown app. In the app you can add or delete as many countdowns as you want. All the Countdowns are saved in an ArrayList. I can't just save them in an database or in the shared preferences because the countdown have to keep running even if you leave the app. I'm using roboguice 2.0 and guice-3.0-no_aop.jar to handle my dependency Injections. Most of the times everthing works fine but sometimes if i start the app i only get the following warning and all the variables like the Arraylist where i saved the countdowns are empty once again. 05-21 13:07:33.260: W