question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a Lint check for not calling super.onCreate

See original GitHub issue

Does Hilt currently not work with Services? I have @AndroidEntryPoint on the Service as well as the Activity/Fragment that starts it. I am trying to field-inject a lateinit var but it stays uninitialized. I heard from a friend that he had the same problem.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Chang-Ericcommented, Jun 29, 2020

@ZacSweers The issue is that because of the way the plugin works with last second substituting the base class via bytecode transformation, the base class at compile time is not the class that has the @CallSuper annotation on it.

1reaction
Chang-Ericcommented, Jun 24, 2020

Thanks, we add @CallSuper to the generated base class but that doesn’t do anything when you use the plugin.

I think we’ll probably want to add our own lint check for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve your code with lint checks - Android Developers
Configuring lint checking in Java or Kotlin​​ The following example shows how you can turn off lint checking for the NewApi issue in...
Read more >
Why do we have to call super in Android sometimes?
This depends on the base class implementation. Most of the time, Android checks to see that the superclass method was called with a...
Read more >
new Lint check: calling the same super function more than ...
If you call `super.onCreate` more than once, things will break. Lint should catch this. Comments.
Read more >
Why do you need Lint in Android - Nyame Bismark - Medium
Add a list of issues you want lint tool to check. The lint.xml file consists of an enclosing <lint> parent tag that contains...
Read more >
Improving Your Code with lint | Android Developers
To disable lint checking specifically for a Java class or method in your Android project, add the @SuppressLint annotation to that Java code....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found