每当我在Android代码中使用改造时,我都会崩溃,并且进程被杀死。我在项目中没有使用任何c ++代码,因此,这笔现金必须进行翻新或OkHTTP。 改版为2.4.0。
崩溃日志是
* * * * * * * * * * * * * * * *
Build fingerprint: 'Xiaomi/kenzo/kenzo:6.0.1/MMB29M/V9.5.3.0.MHOMIFA:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 13270, tid: 13278, name: FinalizerDaemon >>> com.circle.app <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdeadbaad
Abort message: 'invalid address or address of corrupt block 0x55a0b74290 passed to dlfree'
x0 0000000000000000 x1 0000007fb4e3a7d0 x2 0000000000000001 x3 0000000000000000
x4 0000000000000000 x5 00000000deadbaad x6 0000000000000000 x7 0000000000000010
x8 7f7f7f7f7f7f7f7f x9 6471656b631f6e73 x10 7f7f7f7f7f7f7f7f x11 0101010101010101
x12 0000007fb4e3a7c8 x13 b4bb2508678bd7e4 x14 b4bb2508678bd7e4 x15 0000007fb1d07158
x16 0000007fb4e34a58 x17 0000000000000000 x18 0000007fb1d1c000 x19 00000055a0b74290
x20 0000007fb4e3b000 x21 00000055a0b742a0 x22 0000007fb4e3ba70 x23 0000007fb0d76208
x24 0000007fb0d762b8 x25 0000007fb0d762d8 x26 0000000071d1fc45 x27 00000000718c7370
x28 00000055a05f8750 x29 0000007fb0d75ee0 x30 0000007fb4dd3580
sp 0000007fb0d75ee0 pc 0000007fb4dd3588 pstate 0000000060000000
backtrace:
#00 pc 0000000000047588 /system/lib64/libc.so (dlfree+408)
#01 pc 00000000000195a8 /system/lib64/libc.so (free+20)
#02 pc 000000007421d460 /data/dalvik-cache/arm64/system@framework@boot.oat (offset 0x24fe000)
当使用改造客户端后发生垃圾收集时,将发生此崩溃。正如我在android studi的Android Profiler中使用强制垃圾收集按钮验证的一样
我的改造客户是
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import circle.circle.com.circle.BuildConfig;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.logging.HttpLoggingInterceptor;
import okhttp3.logging.HttpLoggingInterceptor.Level;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient
private static Retrofit retrofit = null;
public static Retrofit getClient() {
if (retrofit == null) {
Interceptor interceptor = chain -> {
Request newRequest = chain.request().newBuilder()
.build();
return chain.proceed(newRequest);
};
// Add the interceptor to OkHttpClient
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.interceptors().add(interceptor);
//Add logging for debug builds
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();
httpLoggingInterceptor.setLevel(Level.BODY);
builder.interceptors().add(httpLoggingInterceptor);
//builder.addNetworkInterceptor(new StethoInterceptor());
}
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
String BASE_URL = "http://myUrlAddress";
retrofit = new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create(gson))
.baseUrl(BASE_URL)
.client(builder.build())
.build();
}
//Log.d(TAG, "getClient: aBase = " + BASE_URL + " url = " + retrofit.baseUrl());
return retrofit;
}
}
更新
我已经解决了问题。我的实际问题不是翻新,而是Gson反序列化Android Location类(实现可打包)