Closed newjing closed 9 years ago
Are you sure that your class is inside main/src/groovy and not in main/src/java folder?
yes, I'm doing everything according to requirements. I wrote everything in Groovy
Let me guess: your view doesn't have any @InjectView
annotations, does it?
No, I really don't have @InjectView in this activity.
I found where the problem is, so weird: If my activity is directly under "activities" package, everything works well. I created a sub package "Login" under "activities" and put it inside, it doesn't work. Why?
I'll try to figure out what happens.
Could you provide some sample? I'm not sure I can reproduce this bug.
If I move this "KFLoginActivity .groovy" from the subfolder up to "acitivities" folder, everything works perfect. Today I repeated it in another project and reproduced this bug.
Thanks for you attention. SwissKnife is really a great tool!
P.S. I have another question, there's demo code in https://github.com/Arasthel/SwissKnife/blob/master/docs/dsl-methods.adoc : context.startActivity(AnotherActivity) { putExtra("key", value) } What is the correct "context" to use it? In an activity class, I tried "this" & getApplicationContext(), both caused error.
@newjing Can you please fork SwissKnife project, then modify sample project to reproduce the bug. And give us a link. Thanks.
ok, I'll do it. That will take a while, coz I 'm behind the China "great wall", it takes some time to check out and check it.
If you could do what @eugene-kamenev said, that would be great.
I've already tried it myself and I can't really make it fail...
As you can see, I created 2 levels of subpackaging and moved the BackgroundActivity
class to the lower of them. Then I just hit run and the compilation works just fine. Maybe it's some configuration error or something :worried:.
You can also upload a copy of the other project somewhere and we can take a look at it, there's no need to modify the sample that way.
EDIT: as for the startActivity
issue, it's actually a bug, I forgot to set the closure parameter as optional, so unless you add a closure at the end it won't build.
I am so sorry @Arasthel & @eugene-kamenev . It must be sth wrong with my own projects , though I haven't found out where.
I tested with SwissKnife fork and it worked. Then I created a new project and it worked. My own project used lots of libraries which might cause conflict or sth. No idea though.
Thanks a lot for your efforts.
I've been using SwissKnife with MainActivity, and everything is working fine.
However, when I create a second Activity, swissknife cannot work.
My second activity code as below (With a Button "testBtn" in layout)
Problem 1: If I input SwissKnife.inject(this) , Compile Error as below:
Alright, I checked previous issues/answers, and it seems "SwissKnife.inject(this) " is not necessary? Then I comment it, and here comes another problem:
Problem 2: @OnClick(R.id.testBtn) never works.
P.S. I 'm a groovy player, and codes are in correct position under groovy/ folder as required. Any idea? Please help! Thanks