Comments (25)
I am also seeing this when using snapshot:
apt 'com.google.dagger:dagger-compiler:2.0-SNAPSHOT'
Maybe related to google/auto@e02e2a8?
from dagger.
Yeah seems like asTypeElements method changed - google/auto@e02e2a8#diff-117761445d686cc88f0b75d965af5a1aL466
from dagger.
What's the correct way to set up gradle to use the jar files to avoid SNAPSHOT issues like this?
I've tried
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
compile files('libs/dagger-2.0-20150122.022617-13.jar');
apt files('libs/dagger-compiler-2.0-20150122.022637-13.jar');
compile 'javax.inject:javax.inject:1'
provided 'javax.annotation:javax.annotation-api:1.2'
}
but it doesn't seem to be working. It compiles without error but it force closes when I run the app (Caused by: java.lang.ClassNotFoundException: Didn't find class "com.abc.CustomApplication" on path: DexPathList
), and intelliJ also doesn't seem be able to find Dagger_AppComponent.builder() that's reference in the CustomApplication file. I didn't see these issues when using SNAPSHOT from maven directly, and would like to know how to use the JAR files directly.
from dagger.
You haven't included the dependencies of the dagger-compiler
on the apt classpath.
from dagger.
Thanks. Adding the following based on the pom.xml file worked (to use the dagger-compiler jar, sort of)
apt files('libs/dagger-producers-2.0-20150122.022620-1.jar');
apt 'com.google.auto:auto-common:1.0-SNAPSHOT'
apt 'com.squareup:javawriter:2.5.0'
apt 'com.google.guava:guava:18.0'
However, since dagger-compiler depends on the snapshot version of auto-common anyway, back to square one I guess!
For others running into this NoSuchMethodError
issue, you can (temporarily) include the previous auto-common snapshot from https://oss.sonatype.org/content/repositories/snapshots/com/google/auto/auto-common/1.0-SNAPSHOT/ as a work around.
compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
apt 'com.google.dagger:dagger-compiler:2.0-SNAPSHOT'
provided 'javax.annotation:javax.annotation-api:1.2'
apt files('libs/auto-common-1.0-20150122.001631-7.jar');
apt 'com.google.guava:guava:18.0'
from dagger.
Damn, this is bad, one snapshot library depends on another snapshot library.. Callback snapshot hell.
What about semantic versioning and/or fixed inner dependencies? I don't want to talk about #109, but inner snapshot dependencies — serious problem for production
from dagger.
Ugh, please no. A shaded compiler jar is all that's needed.
from dagger.
Downloading jars... Interesting, how many developers are currently thinking "WTF with my build?" :)
from dagger.
To expand a bit on the workaround, you need to download and reference three separate jars, temporarily replacing the dagger-compiler dependency with the following:
apt files('libs/dagger-producers-2.0-20150122.022620-1.jar')
apt files('libs/dagger-compiler-2.0-20150122.022637-13.jar')
apt files('libs/auto-common-1.0-20150122.001631-7.jar')
apt 'com.squareup:javawriter:2.5.0'
apt 'com.google.guava:guava:18.0'
from dagger.
With the above workaround I was running into java.lang.ClassNotFoundException
in android runtime so I did the following:
apt ('com.google.dagger:dagger-compiler:2.0-SNAPSHOT') {
exclude group: 'com.google.auto'
}
apt files('libs/auto-common-1.0-20150122.001631-7.jar')
so that requites only one jar instead of three, hopefully this gets fixed soon
from dagger.
IMHO it might be done easier, since fortunately dagger-compiler has it's jar-with-dependencies
variant (download it).
Here's how I changed my build.gradle
:
- compile 'com.google.dagger:dagger:2.0-SNAPSHOT'
+ compile files('libs/dagger-2.0-20150122.022617-13.jar');
+ compile 'javax.inject:javax.inject:1' //transient dependency of Dagger core
- apt "com.google.dagger:dagger-compiler:2.0-SNAPSHOT"
+ apt files('libs/dagger-compiler-2.0-20150122.022637-13-jar-with-dependencies.jar');
Actually, this is madness (#109). But it works.
from dagger.
+1 I have the same problem.
from dagger.
I was seeing this error earlier as well. Just out of interest, was that causing peoples Dagger_{whatever}Component
to not be compiled correctly?
from dagger.
I am in the process of exporting a new update - this was the syncs getting out of sync, and I"ll fix. I'm also going to be jarjar-ing the binary so when we publish a snapshot (or release) it'll be resistent to dependency version skew.
from dagger.
👍
from dagger.
Thanks @cgruber!
from dagger.
Thank you for looking into this.
from dagger.
PR #115 fixes this. Should merge shortly.
from dagger.
So - apologies for all of this. Having seen these interactions, I'm going to do a little work on my end to keep us from dealing with this sort of skew. But the new version should be out, and it should work.
from dagger.
@cgruber it's okay for alpha-beta-whatever-snapshot, at least, Dagger didn't delete /usr/ folder 👍
from dagger.
Thanks! 👍
from dagger.
Appreciated
from dagger.
It's alive again! Thanks @cgruber !
from dagger.
👍 💯
from dagger.
I'll close this now. As this is working with the latest snapshot. Thanks @cgruber (and co).
from dagger.
Related Issues (20)
- Cannot use legacy dagger.spi.BindingGraphPlugin while compiling with KSP HOT 1
- CVE-2976 HOT 1
- [KSP] Performance regression vs KAPT HOT 7
- KSP: Consistently failing build in first run and success on second run HOT 8
- Lots of warnings with KSP related to incremental compilation HOT 8
- ComponentProcessingStep was unable to process 'com.example.lab0.App_HiltComponents.SingletonC' because '<error>' could not be resolved. HOT 8
- getViewModel crash intermittently with NullPointerException / IllegalArgumentException HOT 3
- [KSP] internal @Provides method produces non-compiling code using dagger-android HOT 5
- [KSP] dagger-android unresolved generated subcomponent for internal module methods used across gradle modules HOT 3
- Unable to build with 2.48.1 - 2.49 and 2.50 HOT 2
- KSP processing does not see member injections from typealiased superclass in 2.50 HOT 2
- Regression "warning: [cast] redundant cast to Map" when updating from 2.49 to 2.50 HOT 1
- Dagger-Hilt 2.49: Activity onCreate() and onDestroy() code is generated, but our base Activity class has these final HOT 3
- Dagger 2.50 produces code that calls deprecated method HOT 1
- Feature Request: lint rule for EarlyAccessPoint classes to prevent @Inject abuse HOT 13
- no
- Feature request: Add support for K2 compiler. HOT 2
- @HiltViewModel Unit test problem. HOT 2
- WorkerAssistedFactories are not created on APK builds HOT 5
- Getting `Unexpected annotation value: TransformedVisibilityMarker` error during unit test HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dagger.