android - java.lang.IllegalArgumentException: No Retrofit annotation found. (parameter #1) -
i encountered error no retrofit annotation found. (parameter #1). i'm trying search google nothing:
fragmentcomment.java
private void createnew() { subscriptions.add(leadersubscription); commentdto.settype(constants.training_day_old); observable<resultresponse> observable = candidaterequest.postresultcandidate(commentdto); leadersubscription = observable.subscribeon(schedulers.newthread()) .observeon(androidschedulers.mainthread()) .subscribe(new jvsubscriber<resultresponse>(activity) { @override public void handlesuccess(resultresponse baseresponse) { if (constants.success.equals(baseresponse.getsuccess())) { intent intent = new intent(getactivity(), trainingactivity.class); intent.setflags(intent.flag_activity_new_task); getactivity().startactivity(intent); setenableconfirm(); toast.maketext(getactivity(), getstring(r.string.success), toast.length_short).show(); } else { btnconfirm.settext(r.string.title_enable); btnconfirm.setbackgroundresource(r.drawable.custom_button_history); btnconfirm.setenabled(true); toast.maketext(getactivity(),baseresponse.getmessage(), toast.length_short).show(); } log.d(tag, "jv-success: "); } }); subscriptions.add(leadersubscription);
candidaterequest.java
public interface candidaterequest { @headers("content-type: application/json") @post(constants.url_result_candidate) observable<resultresponse> postresultcandidate( @body commentdto commentdto); @get(constants.url_staff_schedule_list) observable<staffresponse> getschedulesbystaffid( @path("id") long maidid, @path("fromdate") long fromdate, @path("todate") long todate); @get(constants.url_leader_name) observable<candidateleaderresponse> getleadername( );
file build.gradle
buildscript { repositories { mavencentral() } dependencies { classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' }
}
apply plugin: 'com.android.application' apply plugin: 'android-apt'
android {
compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:support-v4:23.0.2' compile 'com.android.support:support-v13:23.0.0' compile 'com.android.support:design:23.0.1' compile 'com.jakewharton:butterknife:8.2.1' apt 'com.jakewharton:butterknife-compiler:8.2.1' compile 'com.squareup.retrofit:retrofit:1.7.1' compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' compile 'com.squareup.okhttp:okhttp:2.0.0' compile 'com.squareup.okhttp3:logging-interceptor:3.3.1' compile 'com.fasterxml.jackson.core:jackson-databind:2.4.+' compile 'com.fasterxml.jackson.core:jackson-core:2.4.+' compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.+' compile 'com.squareup:otto:1.3.5' compile 'com.onesignal:onesignal:3.+@aar' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:recyclerview-v7:23.2.0' ext.googleplayversion = "9.6.1" compile "com.google.firebase:firebase-ads:$googleplayversion" compile "com.google.firebase:firebase-database:$googleplayversion" compile "com.google.android.gms:play-services-ads:$googleplayversion" compile "com.google.android.gms:play-services-maps:$googleplayversion" compile "com.google.android.gms:play-services-gcm:$googleplayversion" compile "com.google.android.gms:play-services-analytics:$googleplayversion" compile "com.google.android.gms:play-services-location:$googleplayversion" compile 'io.reactivex:rxandroid:1.2.1' compile 'io.reactivex:rxjava:1.1.6'
}
you need declare retrofit in app gradle dependencies.
compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0'
like this
Comments
Post a Comment