Я реализовал вызовы API, используя Refrofit 2.7.1 для android, но, к сожалению, я не получаю никакого ответа в моем приложении, если ответ должен был быть возвращен, тогда он возвращает уведомление, которое возвращает json. Сначала он работал правильно, но после того, как я получил ava.lang.BootstrapMethodError: он не ответил снова, даже после того, как я его разрешил, но я до сих пор не получаю никакого ответа на мои вызовы API.
вот моя зависимость от модификации
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
вот моя функция API
button4.setOnClickListener (new View.OnClickListener () {
@Override
public void onClick(View v) {
Toast.makeText (getActivity (),"Request Sent ",Toast.LENGTH_SHORT).show ();
//fetching data from the api
Retrofit retrofit = new Retrofit.Builder ()
.baseUrl ("https://api.myjson.com/")
.addConverterFactory (GsonConverterFactory.create ())
.build ();
OcappJsonApiControlNumber ocappJsonApi = retrofit.create (OcappJsonApiControlNumber.class);
Call<List<StudentClearanceControlNumber>> listCall = ocappJsonApi.getStudents ();
listCall.enqueue (new Callback<List<StudentClearanceControlNumber>> () {
@Override
public void onResponse(Call<List<StudentClearanceControlNumber>> call, Response<List<StudentClearanceControlNumber>> response) {
if(!response.isSuccessful ())
{
Toast.makeText (getActivity (),"From OCApp " + response.code (),Toast.LENGTH_LONG).show ();
return;
}
List<StudentClearanceControlNumber> studentClearancess = response.body ();
for ( final StudentClearanceControlNumber studentClearance: studentClearancess)
{
//firebase checking for registationnumber
String user_id = firebaseAuth.getCurrentUser ().getUid ();
firebaseAuth.getInstance ().getCurrentUser ();
firebaseDatabase = FirebaseDatabase.getInstance ();
DatabaseReference databaseReference = firebaseDatabase.getReference ().child ("Users").child (user_id);
databaseReference.addValueEventListener (new ValueEventListener () {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
//converting the json into the notification
//display notification after getting the response
createNotificationChannel ();
//create an intent to open notification activity
Intent NotificationActivity = new Intent (getActivity (), NotificationActivity.class);
NotificationActivity.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent statusPendingIntent = PendingIntent.getActivity (getActivity (),0,NotificationActivity,PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder (getActivity (), CHANNEL_IDcontrolnumber);
builder.setSmallIcon (R.drawable.ic_near_me_black_24dp);
builder.setContentTitle ("Control Number For Graduation Gown");
builder.setPriority (NotificationCompat.PRIORITY_DEFAULT);
builder.setAutoCancel (true);
NotificationActivity.putExtra ("controlnumber","Control Number:" +studentClearance.getControlNumber () );
NotificationActivity.putExtra ("reason","REASON: Graduation Gown Fee");
NotificationActivity.putExtra ("department","SUA BURSAR");
builder.setContentIntent (statusPendingIntent);
StudentDataFirebase studentDataFirebase = dataSnapshot.getValue (StudentDataFirebase.class);
String registationnumber = studentDataFirebase.getRegistrationNumber ();
if(studentClearance.getRegistrationno () .equals (registationnumber))
{
//notification begins here
Bitmap bitmap = BitmapFactory.decodeResource (getResources (), R.drawable.bursar);
builder.setLargeIcon (bitmap);
builder.setStyle (new NotificationCompat.InboxStyle ()
.addLine ("Control Number: " +studentClearance.getControlNumber () )
.setSummaryText ("SUA Bursar"));
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from (getActivity ());
notificationManagerCompat.notify (NOTIFICATION_IDGownControlNumber,builder.build ());
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
Toast.makeText (getActivity (),"OOPS an ERROR occured",Toast.LENGTH_LONG).show ();
}
});
}
}
@Override
public void onFailure(Call<List<StudentClearanceControlNumber>> call, Throwable t) {
Toast.makeText (getActivity (),"From OCApp " +t.getMessage (),Toast.LENGTH_LONG).show ();
}
});
}
});
Пробовали предыдущие версии pf Retrofit, но я до сих пор ничего не получите
вот что написано в журнале
D/OpenSSLLib: OpensslErr:Module:12(177:); file:external/boringssl/src/crypto/asn1/asn1_lib.c ;Line:168;Function:ASN1_get_object
D/OpenSSLLib: OpensslErr:Module:12(177:); file:external/boringssl/src/crypto/asn1/asn1_lib.c ;Line:168;Function:ASN1_get_object
D/OpenSSLLib: OpensslErr:Module:12(177:); file:external/boringssl/src/crypto/asn1/asn1_lib.c ;Line:168;Function:ASN1_get_object
D/OpenSSLLib: OpensslErr:Module:12(177:); file:external/boringssl/src/crypto/asn1/asn1_lib.c ;Line:168;Function:ASN1_get_object
D/ViewRootImpl[Toast]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
D/Surface: Surface::allocateBuffers(this=0x89e11000)
D/OpenSSLLib: OpensslErr:Module:30(110:); file:external/boringssl/src/crypto/fipsmodule/cipher/cipher.c ;Line:563;Function:EVP_CIPHER_CTX_set_key_length
D/Surface: Surface::connect(this=0x89e11000,api=1)
D/Surface: Surface::disconnect(this=0x89e11000,api=1)
D/View: [Warning] assignParent to null: this = android.widget.LinearLayout{2dc2919 V.E...... ......ID 0,0-235,72}