I\'m trying to use GSON in my project, but my application is crashing, with logcat saying that com.google.gson.Gson cannot be found. I\'ve put import com.google.gson.Gson on my
I am using Android Studio I had the same problem I had solve it by select project press f4 from popup click app and in dependencies select file dependency and select the three folders which I had pasted in lib directory
What worked for me: Check the checkbox next to the lib (gson-2.0.jar) in: 'Project Properties' -> 'Java Build Path' -> 'Order and Export' tab. Then do a clean/build.
This adds the exported=true attribute to the classpath entry
<classpathentry exported="true" kind="lib" path="libs/gson-2.0.jar"/>
I have been trying the same thing and read so many answers and tried so many things but to not vial, but i solved this problem by doing just one click and its simple.
1) Add your .jar file in libs folder make sure its libs not lib 2) Clean and Build your project you will see that file under libs folder 3) right click the file and go to build path and select add to build path
Run your project it will work fine. Hope this helps
Do not edit .classpath file directly or even put files into lib folders out of Eclipse. Instead use the Java Build Path->Order and Export tab to select libraries to be exported in the final deployment unit (eg war/apk) To be on safer side, do a Project->Clean after you change the build path.
Have you put the jar file in the libs folder of the project? If not , try moving it there, creating the folder if required. Should be at the same level as the src folder.
I had a similar issue trying to get an app built and that solved it.
If Projct Properties -> Java build path -> Add external jars doesn't work and your project is a web project, try adding the gson jar directly to the server lib folder. Example: for apache Tomcat to apache-tomcat/lib.