Setup Proto Datastore
Published:
This documentation kinda off.
- Go to the official repo
- Using the latest version OK
- In
project/app/build.gradle, add thedependencies{}implementation "com.google.protobuf:protobuf-javalite:3.19.4" implementation 'androidx.datastore:datastore:1.0.0' - Make your own
.proto, read the guide about it here - In your
.protofile, these two lines:option java_package = "com.example.application"; option java_multiple_files = true;are important if you want to avoid the unnecessary compile error because of generated java files. Also, adjust your package name accordingly.
- Rebuild
- You should have the generated file under your package:
com.example.application.YourFile - Proceed to make your implemented
Serializerand dataStore file.
