I'm trying to use the new Android Studio but i can't seem to get it working correctly.
I'm using the Gson-library to serialize/deserialize JSON-objects. But the library somehow isn't included in the build.
I created a new project with just a MainActivity. Copied gson-2.2.3.jar in the /libs folder and added it as a library (right click->Add as library). This includes the jar in android studio so it can be referenced from the source files.
When I try to run the project it cannot compile so i added
I've been struggling with the same thing for many hours, trying to get the Gson jar to work no less. I finally cracked it – here are the steps I took:
gson-2.2.4.jar) into the
compile files('libs/gson-2.2.4.jar')is in your
gradlew clean. I'm on Mac OS X, the command might be different on your system
After I did the above four, it started working fine. I think the 'Add as library' step was the one I'd previously missed, and it didn't work until I cleaned it either.
[Edit - added the
build.gradle step which is also necessary as others have pointed out]