Skip to content

Instantly share code, notes, and snippets.

@btow
Last active June 28, 2018 13:58
Show Gist options
  • Save btow/aa0175bcdd5359f6c30daec8cc3729fc to your computer and use it in GitHub Desktop.
Save btow/aa0175bcdd5359f6c30daec8cc3729fc to your computer and use it in GitHub Desktop.
Retrofit 2: com.sun.jdi.InternalException : Unexpected JDWP Error: 103
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [ moxyReflectorPackage : 'com.example.module_00_lib' ]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
def support = '26.+'
def retrofit = '2.3.0'
def moxy = '1.5.3'
def butterKnife = '8.6.0'
dependencies {
compile project (':_service_lib')
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "com.android.support:appcompat-v7:$support"
compile "com.android.support:recyclerview-v7:$support"
compile "com.android.support:cardview-v7:$support"
compile "com.android.support:support-v4:$support"
compile "com.android.support:design:$support"
compile "com.squareup.retrofit2:retrofit:$retrofit"
compile "com.squareup.retrofit2:converter-gson:$retrofit"
compile "com.arello-mobile:moxy:$moxy"
compile "com.arello-mobile:moxy-app-compat:$moxy"
annotationProcessor "com.arello-mobile:moxy-compiler:$moxy"
compile "com.jakewharton:butterknife:$butterKnife"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnife"
compile 'com.google.code.gson:gson:2.7'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-all:1.10.19'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'org.robolectric:robolectric:3.1-rc1'
}
package com.example.module_00_lib.model;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ControllerMarketAPI {
private static final String BASE_URL = "http://localhost/market/";
public static MarketAPI getAPI() {
Gson gson = new GsonBuilder()
.setLenient()
.create();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
return retrofit.create(MarketAPI.class); //Перед возвратом объекта емеем его такое значение:
// retrofit2.Retrofit$1@3309c87
}
}
package com.example.module_00_lib.model;
import com.example.module_00_lib.model.catalog.GoogsCategoriesJSON;
import com.example.module_00_lib.model.index.IndexJSON;
import retrofit2.Call;
import retrofit2.http.GET;
public interface MarketAPI {
@GET("index.json")
Call<IndexJSON> getIndex();
@GET("goods/categories.json")
Call<GoogsCategoriesJSON> getCategories();
// @GET("goods/{category}/subcat.json")
// Call<GoogsSubCategory> getSubcatByCat(@Path("categoriy") int categorie);
}
package com.example.module_00_lib.presentation.presenter.recycler;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;
import com.arellomobile.mvp.InjectViewState;
import com.arellomobile.mvp.MvpPresenter;
import com.example.module_00_lib.R;
import com.example.module_00_lib.exceptions.CreateListQiwiUsersException;
import com.example.module_00_lib.exceptions.DBCursorIsNullException;
import com.example.module_00_lib.exceptions.DBIsNotDeletedException;
import com.example.module_00_lib.model.ControllerMarketAPI;
import com.example.module_00_lib.model.MarketAPI;
import com.example.module_00_lib.model.catalog.GoodsCategory;
import com.example.module_00_lib.model.catalog.GoogsCategoriesJSON;
import com.example.module_00_lib.model.Module00;
import com.example.module_00_lib.model.QiwiUsersBalances;
import com.example.module_00_lib.presentation.view.recycler.RecyclerCatalogsMenuView;
import com.example.service_library.model.ControllerDB;
import com.example.service_library.model.Service;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import retrofit2.Retrofit;
import static com.example.module_00_lib.model.Module00.getGoodsSubcategorysList;
import static com.example.module_00_lib.model.Module00.getGoodsCategorysList;
import static com.example.module_00_lib.model.Module00.isCategorysListCreated;
import static com.example.module_00_lib.model.Module00.setQiwiUsersBalancesListCreated;
import static com.example.module_00_lib.model.Module00.setGoodsCategorysList;
import static com.example.module_00_lib.model.Module00.setCategorysListCreated;
@InjectViewState
public class RecyclerCatalogsMenuPresenter extends MvpPresenter<RecyclerCatalogsMenuView> {
private static Response<GoogsCategoriesJSON> mGoogsCategorysJSON = null;
private static LoadingCategorysTask mLoadingCategorysTask;
private static ExchangeCategorysTask mExchangeCategorysTask;
//.......................................................................
public static class LoadingCategorysTask extends AsyncTask<Void, Void, String> {
@Override
protected String doInBackground(Void... params) {
String msg = "";
try {
MarketAPI marketAPI = ControllerMarketAPI.getAPI(); //Здесь получаем такое значение: retrofit2.Retrofit$1@c3d4c50
mGoogsCategorysJSON = marketAPI.getCategories().execute(); //<--------Место возникновения ошибки при дебаге
// com.sun.jdi.InternalException : Unexpected JDWP Error: 103
Module00.getModule00().downloadData(mGoogsCategorysJSON); // после чего выполнение прерывается по Exception
} catch (Exception e) {
e.printStackTrace();
Service.getDequeMsg().pushMsg(e.getMessage());
}
try {
setGoodsCategorysList(createGoodsCategorysList());
} catch (InterruptedException e) {
e.printStackTrace();
msg = e.getMessage();
}
try {
if (getGoodsCategorysList() == null) {
msg = Service.getServiceString(R.string.the_dataset_is_null);
}
} catch (DBCursorIsNullException e) {
e.printStackTrace();
msg = e.getMessage();
}
return msg;
}
@Override
protected void onPostExecute(String aMsg) {
super.onPostExecute(aMsg);
if (!aMsg.equals("")) {
Toast.makeText(Service.getService().getBaseContext(), aMsg, Toast.LENGTH_SHORT).show();
}
}
}
}
09-07 07:48:13.971 11488-11513/com.example.users_interface E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.example.users_interface, PID: 11488
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:318)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: com.example.module_00_lib.exceptions.CreateListQiwiUsersException: Error loading response in DB: The response is null: more 100 iterations
at com.example.module_00_lib.presentation.presenter.recycler.RecyclerCatalogsMenuPresenter.createGoodsCategorysList(RecyclerCatalogsMenuPresenter.java:97)
at com.example.module_00_lib.presentation.presenter.recycler.RecyclerCatalogsMenuPresenter.access$100(RecyclerCatalogsMenuPresenter.java:39)
at com.example.module_00_lib.presentation.presenter.recycler.RecyclerCatalogsMenuPresenter$LoadingCategorysTask.doInBackground(RecyclerCatalogsMenuPresenter.java:199)
at com.example.module_00_lib.presentation.presenter.recycler.RecyclerCatalogsMenuPresenter$LoadingCategorysTask.doInBackground(RecyclerCatalogsMenuPresenter.java:183)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
at java.lang.Thread.run(Thread.java:761) 
@sviaty
Copy link

sviaty commented Jun 28, 2018

did you to solve the problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment