Importing gson library - working for new sketches, but not for existing ones
in
Contributed Library Questions
•
9 months ago
I'm trying to use the com.google.gson library in my sketch. I've followed the usual instructions to install Java libraries and it works fine, unless I try to use it in a specific project!
To be clear, if I create a new sketch and click Import Library, gson shows up. If I select gson, the import statements appear, I can instance gson objects fine, everything seems okay.
The problem comes when I try to open an existing project and import gson. In that case I get the familiar error:
- "Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder.
- ExportImport.java:1:0:1:0: The package âcom.googleâ does not exist. You might be missing a library."
Does anyone know what might cause this difference between new sketches and an existing project? I'm at a loss!
My Sketchbook file structure is as follows:
Anything seem specifically wrong? I've tried cleaning out the build-tmp folder, running the sketch from within processing and through processing-java..├── Tutorials│ ├── Camera.java│ ├── ExportImport.java│ ├── FileChooser.java│ ├── GUI.java│ ├── Geometry.java│ ├── Image.java│ ├── KeyboardControls.java│ ├── ModifiableVector.java│ ├── Shape.java│ ├── ShapeManager.java│ ├── Tutorials.pde│ ├── ZoomControl.java│ ├── build-tmp│ │ ├── Camera.class│ │ ├── FileChooser.class│ │ ├── GUI.class│ │ ├── Geometry.class│ │ ├── Image.class│ │ ├── KeyboardControls.class│ │ ├── ModifiableVector.class│ │ ├── Shape.class│ │ ├── ShapeManager.class│ │ ├── Tutorials.class│ │ ├── ZoomControl.class│ │ └── source│ │ ├── Camera.java│ │ ├── ExportImport.java│ │ ├── FileChooser.java│ │ ├── GUI.java│ │ ├── Geometry.java│ │ ├── Image.java│ │ ├── KeyboardControls.java│ │ ├── ModifiableVector.java│ │ ├── Shape.java│ │ ├── ShapeManager.java│ │ ├── Tutorials.java│ │ └── ZoomControl.java│ └── data│ ├── folder.png│ ├── polygon.png│ ├── save.png│ ├── zoomin.png│ └── zoomout.png├── libraries│ └── gson│ └── library│ └── gson.jar├── modes└── tools
1