Comments (24)
Could you check the following things for me:
- Is the factory actually generated (if you look in the build folder)?
- Does the same issue happen with 0.3.0?
from kotshi.
Ok, I've implemented so that the pre 1.0 way is allowed too. I'll try to file an issue on youtrack and fix the root issue.
from kotshi.
Actually it's strange. When just cloning the repo and running the test from command line, everything works fine. But if I then compile and launch the app using Android Studio and then call ./gradlew test
and then launch it using Android Studio again, it fails.
from kotshi.
It works just fine for me, weird.
from kotshi.
These steps fail 100% of the time for me.
- Git Clone
- Add it in android studio
- Press run
- Run
./gradlew test
in the terminal tab
from kotshi.
It seems to be an issue regarding KAPT, if I clean and build again it works just fine.
from kotshi.
Do you have any idea what is going on there? I can't find other words for reporting it upstream other than "not working sometimes" ;)
from kotshi.
I ask myself why that whole ceremony is necessary at all.
I mean by looking at FactoryProcessingStep.kt it seems like there can be only a single factory at all. So why not just generate a factory?
It feels strange to create a class, annotate it with something and then let that class extend something that is based upon the fact that it is annotated. That's a circular chain.
from kotshi.
from kotshi.
Having same problem. Running the app is fine but running unit test or UI test will cause the factory not to be generated. I got this error in my terminal
e: /Users/vincent/AndroidStudioProjects/{Project NAME}/data/build/tmp/kapt3/stubs/debug/mm/pulse/prices/data/network/AppJsonAdapterFactory.java:10: error: cannot find symbol
public final class AppJsonAdapterFactory extends mm.pulse.prices.data.network.KotshiAppJsonAdapterFactory {
^
symbol: class KotshAppJsonAdapterFactory
location: package mm.pulse.prices.data.network
FAILURE: Build failed with an exception.
from kotshi.
It seems like the factory is not generated under build folder, the jsonadpater each object is created tho.
EDIT: Seems to be working fine with 0.3.0. I'll be sticking to it for a while
from kotshi.
I wonder if it has to do with the fact that you subclass something that doesn't exist. But it should still run the code.
from kotshi.
Btw the generation of the adapters is completely reliable.
As a workaround I just copied the generated factory and manually add new adapters by hand.
@vincent-paing Do you also have the kotshi stuff in a library module?
from kotshi.
Yes, I'm having kotshi stuffs in my library module(data module as in the path). Trying to build an app with clean architecture so I'm separating it from my actual app module.
from kotshi.
from kotshi.
Hmm, ok. So this seems to be a universal problem them, we could just revert to the previous way of implementing the factory but I would want to understand why it's happening. It feels like a bug in kapt and not Kotshi.
from kotshi.
I wonder if it's because of the bump to Kotlin 1.2.21, only thing I can think of that might cause this.
from kotshi.
from kotshi.
Hmm, ok. Well I don't really know what could cause this: 0.3.0...1.0.0
from kotshi.
from kotshi.
I'll add a PR that allows both the new and old way of implementing the factory. Let's see if that helps.
from kotshi.
Please try the snapshot 1.1.0-20180215.183751-6
, with that you can use the old way of implementing the factory:
@KotshiJsonAdapterFactory
abstract class MyFactory : JsonAdapter.Factory {
companion object {
@JvmField
val INSTANCE: MyFactory = KotshiMyFactory()
}
}
Let me know if the problem persists.
from kotshi.
from kotshi.
FYI, the issue has been fixed in the latest version of Kotshi and the preferred way to declare you factory is as an object
that subclasses the generated factory
from kotshi.
Related Issues (20)
- invalid code in xxxJsonAdapter generated with @JsonSerializable HOT 1
- Unable to build project with Jetifier enabled (2.0.2) HOT 1
- Investigate support for inline classes HOT 1
- all of the objects have one companion object in ram ?!!?! HOT 3
- Migrate to KSP
- Implementation documentation or sample app? HOT 5
- Kotlin 1.5 borked HOT 3
- Generated annotation not found when compiling against Java 11 HOT 10
- Alternative annotation for custom names HOT 9
- v2.9.0: Excess code generated in adapters (Kapt) HOT 4
- Possible race condition in KSP factory generation HOT 12
- 2.10.0 KSP generates non-compilable classes when nullable field with same name as class and default value HOT 4
- 2.10.1 KSP generated adapters have trouble with generic typealiases when there is a default value HOT 3
- Serialisation issue is sallowed HOT 2
- Unresolved reference: KotshiAppJsonAdapterFactory HOT 2
- KotshiApplicationJsonAdapterFactory does not have a companion object HOT 6
- Usage with JVM 11 HOT 3
- Backend Internal error HOT 5
- [Intermittent] No JsonAdapter is getting created for random response classes after migrating to ksp from kapt HOT 4
- KSP: Failed to analyze class 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 kotshi.