8000 Android 2.3: Classes generated with @EActivity don't contain method getDeclaredMethods() · Issue #747 · androidannotations/androidannotations · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Android 2.3: Classes generated with @EActivity don't contain method getDeclaredMethods()  #747

@AnnKrajnik

Description

@AnnKrajnik

I use Android Studio and Gradle to build my project, version of annotations - 3.0-SNAPSHOT. When I try to call method getDeclaredMethods() for my activity's class then it throw NoSuchMethod exception on devices(and emulators) with Android 2.3.x. On devices with 4.0 and later all work good.
Code sample:

@EActivity(R.layout.activity_test)
public class CompanyActivity extends NavigationActivity{
...
@AfterViews
void init(){
Method[] ms = this.getClass().getDeclaredMethods();
   ...
}
}

Error stack trace:
Caused by: java.lang.NoSuchMethodException
at java.lang.Class.getDeclaredMethods(Native Method)
at java.lang.ClassCache.getDeclaredMethods(ClassCache.java:140)
at java.lang.Class.getDeclaredMethods(Class.java:757)
at my.app.test.activity.TestActivity.init(TestActivity.java:25)
at my.app.test.activity.TestActivity_.onViewChanged(TestActivity_.java:43)

When I call this method for another generated classes - for example, generated with @efragment or with @eviewgroup - app doesn't crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0