Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot resolve SerializedName

Tags:

android

I made a Bean Class but when i run it this is giving errors. I don't know how can i fix it. Please help me.

 Error:(7, 8) error: cannot find symbol class SerializedNameError:Execution failed for task ':app:compileDebugJavaWithJavac'.

This is build.gradle:

 apply plugin: 'com.android.application'android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.example.administrator.Myappliction"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}}   dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.android.support:design:23.1.1'
compile files('libs/gson_1.7.jar')
compile files('libs/gson-2.2.4.jar')
compile "com.google.android.gms:play-services:8.3.0"}
like image 774
Tom Avatar asked Mar 03 '16 08:03

Tom


1 Answers

in your model:

import com.google.gson.annotations.SerializedName;

in build.gradel add gson and converter-gson

dependencies {
.
.
 implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
 implementation 'com.google.code.gson:gson:2.6.2'
}
like image 155
Yasser Avatar answered Sep 27 '22 21:09

Yasser