Comments (6)
Okay, the above is obviously stupid in terms of source sets.
This here seems to work. Is this correct?
app/build.gradle:
kotlin {
sourceSets {
debug {
kotlin.srcDir("build/generated/ksp/debug/kotlin")
}
release {
kotlin.srcDir("build/generated/ksp/release/kotlin")
}
}
}
from compose-destinations.
Glad this helped. I you prefer, you can close this issue. On the other hand it would be nice to keep it open until the root cause in KSP is fixed or to track your current status in terms of better solutions (e.g. same location for debug and release).
from compose-destinations.
Is that working? To be honest I have not setup this for multiple variants. But this seems related with the KSP issue and not directly with this library.
Have you looked here?
I'd love to ear from you when you get this to work, it will help me understand this for the next time someone is struggling with the same thing.
from compose-destinations.
Upfront: I am using Groovy, not kts. I am neither a Gradle expert, nor do I now anything about KSP.
Yes it is working. Actually it is the only setup that I found working for me. But I don't know if this is good or if there are better ways. I would be happy if someone could confirm this.
Yes I had a look at the link you provided.
I wasn't able to transfer the answer from keyboardr to Groovy and my setup.
I tried the answer from Seoung transferred to Groovy without success. Same problem.
android {
buildTypes { // not working for me
debug {
sourceSets {
main {
kotlin.srcDir("build/generated/ksp/debug/kotlin")
}
}
}
release {
...
sourceSets {
main {
kotlin.srcDir("build/generated/ksp/release/kotlin")
}
}
}
}
...
}
From my understanding and my tests I can tell the following:
- when I build with build variant "debug" your code is generated under
build/generated/ksp/**debug**/kotlin
- when I build with build variant "release" your code is generated under
build/generated/ksp/**release**/kotlin
- with any other setup than the one I mentioned is working for me, I cannot get debug AND release to work
- either because classes are not found for the build variant (because I did not yet build this variant)
- or because I get the "Redeclaration" error mentioned above (because then both variants are built)
I think it is crucial that debug AND release is working and not just once.
In your readme you are mentioning under setup (3): "main" and ".../debug/..." which I think is wrong or rather only working as long as you only build the debug variant.
In fact I just tried to build your project with debug and release and got the same "Redeclaration" error. Try it yourself.
When I compare the stuff "you" generate under build/generated/ksp/**debug**/kotlin
and build/generated/ksp/**release**/kotlin
, everything is binary identical. As said, I know nothing about KSP and I don't know if you can/should influence this. But as both folders are identical, it might make sense to ALWAYS generate to e.g. "main" (???) and ALWAYS have this included in the source set independent of the build variant.
from compose-destinations.
Thanks for the elaborate response 👍
I was actually trying myself and I observed the same behaviour you're describing.
I believe your solution appears to be exactly what we want. I'll update my README.md, thank you so much for this 🙂
As far as changing the location to be the same for debug and release, I'll investigate it further, but it seems to me that this is related with this issue that soon should be solved, hopefully. For now, it seems expected, as we see a similar approach done here
Once again, thanks so much for taking the time. If there is anything else I can help with, I'd be glad :)
from compose-destinations.
Closing this issue, since this shouldn't bother anyone now that I updated the Readme. Thank you!
from compose-destinations.
Related Issues (20)
- Multi-module setup throws compilation error that start route does not exist. HOT 3
- Incompatible with androidx.navigation 2.8.0-alpha06 and newer HOT 1
- Theme doesn't carry over to other destinations HOT 1
- Navigate to another module with args HOT 3
- NavTypeSerializer HOT 3
- ModuleDestinations$Includes is defined multiple times in Multi-Module project HOT 4
- [ksp] java.lang.NullPointerException when using custom NavArgument type HOT 13
- No NavGraphs in V2 HOT 14
- Support for Shared Element Transition. HOT 2
- Tab navigation support. HOT 1
- Can not make dependenciesContainerBuilder example work HOT 2
- Serializer for class 'DirectionImpl' is not found in v2 HOT 10
- [2.1.0-beta03] Navgraphs.* cannot be imported in the generated NavGraphs HOT 3
- navargs.* cannot be imported in ArgsToSavedStateHandle.kt HOT 2
- HorizontalPager pageContent can't save state HOT 2
- NavGraphArhs are visible only in "start" destination HOT 6
- Removing from composition and re-adding when navigating HOT 3
- java.lang.IllegalStateException: Duplicate route found X_destination'. Routes must be unique!. In Muli-module project. HOT 2
- Missing classes detected while running R8 on AGP 8.4.0 HOT 2
- Video tutorials for using the library. HOT 1
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 compose-destinations.