dagger-2
error: incompatible types: NonExistentClass cannot be converted to Annotation @error.NonExistentClass()
error: incompatible types: NonExistentClass cannot be converted to Annotation @error.NonExistentClass()
Is there any way of making IntelliJ IDEA recognizing Dagger 2 generated classes in a Java project?
Simplest way I found: Add idea plugin and add Dagger2 dependency like below: plugins { id “net.ltgt.apt” version “0.10” } apply plugin: ‘java’ apply plugin: ‘idea’ sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { testCompile group: ‘junit’, name: ‘junit’, version: ‘4.12’ compile ‘com.google.dagger:dagger:2.11’ apt ‘com.google.dagger:dagger-compiler:2.11’ } Turn on Annotation Processing for IntelliJ: Go to … Read more
Dagger + Retrofit. Adding auth headers at runtime
I personally created an okhttp3.Interceptor that does that for me, which I update once I have the required token. It looks something like: @Singleton public class MyServiceInterceptor implements Interceptor { private String sessionToken; @Inject public MyServiceInterceptor() { } public void setSessionToken(String sessionToken) { this.sessionToken = sessionToken; } @Override public Response intercept(Chain chain) throws IOException { … Read more