Closed AndroidDeveloperLB closed 7 years ago
Can you be more specific about what you changed?
@AndroidDeveloperLB are you referring to removing the android-apt plugin in favor of the built-in annotationProcessor support? The mechanism for passing arguments to annotation processors (like the androidModels
argument that makes models Parcelable) has changed. The new way is documented in the Processor arguments section of the android-apt migration guide (I recommend following this guide closely), and it's also documented on this wiki page. You can also see an example of how to enable that argument in our test project's build.gradle. If that doesn't answer your question, you can join our gitter chat for faster support.
Currently, we have these setting in gradle files:
app-gradle:
apply plugin: 'com.neenbedankt.android-apt'
...
compile 'com.yahoo.squidb:squidb:3.2.3'
compile 'com.yahoo.squidb:squidb-android:3.2.3'
compile 'com.yahoo.squidb:squidb-annotations:3.2.3'
apt 'com.yahoo.squidb:squidb-processor:3.2.3'
...
apt {
arguments {
squidbOptions 'androidModels'
}
}
project-gradle:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
What I wanted is to now follow the new instructions as shown on the repo:
https://github.com/yahoo/squidb But, as I wrote, when I did this, it complained to me that in for each time I've put an entity class into an Intent, it gives an error, because it's not Parcelable as before.
@AndroidDeveloperLB the steps for passing annotation processor arguments like androidModels
are not documented in the README, so you won't see them on the front page of the repo. Did you try following the examples in any of the three docs I linked in my last comment? I'll copy here what it should look like:
android {
...
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = [
squidbOptions : 'androidModels'
]
}
}
}
}
dependencies {
compile 'com.yahoo.squidb:squidb:3.2.3'
compile 'com.yahoo.squidb:squidb-android:3.2.3'
compile 'com.yahoo.squidb:squidb-annotations:3.2.3'
annotationProcessor 'com.yahoo.squidb:squidb-processor:3.2.3'
}
This type of discussion isn't very well suited for GitHub issues, so please do join our gitter chat if you have further questions.
I don't understand. Before, We had some classes that were annotated to become entity classes, and they were also Parcelable. My question is how to still have them Parcelable using the new instructions. Also, why the main page of the repo doesn't mention the first part you've written about (above the "dependencies " ) ? About the samples, do they have the generated classes implement Parcelable? I've failed to import the project of "squidb\samples\squidb-android-sample" . It currently complains to me:
Error:(71, 0) SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable. Open File
Are there other samples?
@AndroidDeveloperLB I'll try to address your questions here, but please come join our gitter chat if you have questions after reading this answer. Github issues are not our preferred channel for this kind of support.
androidModels
argument is the one and only thing that controls whether or not models are Parcelable. Your old code that used apt specified this argument using:
apt { arguments { squidbOptions 'androidModels' } }
. Your new code needs to specify this argument using the format in my last comment, the part above the dependencies block. This new format isn't under squidb's control, it's just how Google's Android gradle plugin (version 2.2.0 and above) works now.androidModels
argument) and an example of how to specify them are clearly documented on this wiki page, which I linked to in my earlier answer as well.If you still have questions, please join our gitter chat here
So I added the lines you said that are missing:
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments = [
squidbOptions : 'androidModels'
]
}
}
...
}
And now it works fine. I don't consider being able to send objects via Intent as an advanced feature. To me it's quite basic thing to be able to send data between Activities, save them, or even retain them across orientation change if needed.
Anyway, thanks.
@AndroidDeveloperLB It has more to do with SquiDB no longer being an Android-only library. As of 3.0, SquiDB core is a Java library, and we support Android and iOS with additional modules. Since we don't want non-Android users to be generating Android-specific code that wouldn't compile without the Android sdk, we left it out of the general README. Making the models Parcelable can be handy, but even for Android users it's not technically required, the Java models will work fine.
Sorry for the confusion and glad you got it resolved.
Yes, but still, could be nice to mention it for the Android developers. Anyway, thanks.
Today I decided to remove the "apt" stuff from the gradle files, to use the new way to import this repo.
Sadly, this caused an issue that I can't pass models via intents, because now the generated model classes do not implement Parcelable anymore.
How come? How can I re-enable this?