f2prateek / dart

Extras binding and intent builders for Android apps.
Apache License 2.0
1.19k stars 88 forks source link

Henson class not found #107

Closed zeng1990java closed 8 years ago

zeng1990java commented 8 years ago

my build.gradle compile 'com.f2prateek.dart:dart:2.0.0' apt 'com.f2prateek.dart:dart-processor:2.0.0' compile 'com.f2prateek.dart:henson:2.0.0' apt 'com.f2prateek.dart:henson-processor:2.0.0' Henson class not found.

dlemures commented 8 years ago

Hi @zeng1990java,

Henson is part of Dart, so it works in conjunction with the rest of the library: the DSL is only generated for activities (fragments, services, ...) which contain @InjectExtra fields or are annotated with @HensonNavigable.

Thus, if you don't use any of these annotations, the Dart/Henson flow is not complete and the Henson DSL is not generated.

Is this your case?

joxad commented 8 years ago

Hi same gradle here, I just created

@HensonNavigable
public class RegisterActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
}

But in my other Activity, Henson is not visible.. any idea?

dlemures commented 8 years ago

Hi @joxad The Henson class is generated at compile time. Have you rebuild after adding the annotation?

Another possibility: have you added the proguard rules? https://github.com/f2prateek/dart#proguard

joxad commented 8 years ago

@dlemures : I build and I have nothing. I have disable proguard for the moment. Do I need to add apt in the gradle as well?

More : I see that Dart.inject() is visible but not Henson ..

dlemures commented 8 years ago

@joxad. Yes, if you are using apt, you need to include it in your build script: https://bitbucket.org/hvisser/android-apt

dlemures commented 8 years ago

@joxad @zeng1990java
any update?

joxad commented 8 years ago

Hi, it's strange I have added Henson/Dart in another project and I had no problem

I have rechecked the differences between my two projects :

In the second one I use apt and it works without problems, but in the first one, no apt and it seems to do not find Henson at all.

stephanenicolas commented 8 years ago

Yes apt is needed so that generated classes (during annotation processes) get visible to Android studio.

Le mer. 23 mars 2016 16:32, joxad notifications@github.com a écrit :

Hi, it's strange I have added Henson/Dart in another project and I had no problem. I'll need to recheck the differences between both of them. In the second one I use apt and it works without problemes, but in the first one, no apt and it seems to do not find Henson at all.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/f2prateek/dart/issues/107#issuecomment-200582516

dlemures commented 8 years ago

15 days from the last unresolved comment with no updates, closing. Can be reopened if required.