It’s been some years since I have programmed Java and I am having trouble with resolving a build issue with not finding a symbol for a class in the same package directory structure.
package com.A.B.C; public class Manager { ... }
The following class is attempting to reference Manager
. Note the package declarations for both classes.
package com.A.B; import com.A.B.C.Manager; // I have also tried omitting this import statement; same result public class MyApp extends Application { ... @Override public void onCreate() { ... registerActivityLifecycleCallbacks(Manager); // cannot find symbol SessionManager } ... }
I am importing com.A.B.C.Manager
in other source files and able to reference Manager
there but, for this source file, Gradle cannot resolve the symbol.
What am I missing? (This is an Android project by the way, in case that is relevant.)
In advance, thank you.
Advertisement
Answer
That Manager class have to implement Application.ActivityLifecycleCallbacks like this:
package com.A.B.C; public class Manager implements Application.ActivityLifecycleCallbacks{ ... }
Also, I guess you missed the new while calling registerActivityLifecycleCallbacks() :
registerActivityLifecycleCallbacks(new Manager());