diff --git a/manager/app/build.gradle.kts b/manager/app/build.gradle.kts index 7a083bc5e456..2e49ff203f16 100644 --- a/manager/app/build.gradle.kts +++ b/manager/app/build.gradle.kts @@ -143,12 +143,12 @@ dependencies { implementation ("io.reactivex.rxjava2:rxjava:2.1.8") implementation ("com.squareup.retrofit2:retrofit:2.4.0") implementation ("com.squareup.retrofit2:converter-gson:2.4.0") - implementation ("com.squareup.retrofit2:converter-scalars:2.4.0") +// implementation ("com.squareup.retrofit2:converter-scalars:2.4.0") implementation ("com.squareup.retrofit2:adapter-rxjava2:2.4.0") - implementation ("com.squareup.okhttp3:logging-interceptor:4.9.0") +// implementation ("com.squareup.okhttp3:logging-interceptor:4.10.0") implementation( "com.jakewharton.rxrelay2:rxrelay:2.1.0") - implementation ("com.squareup.okhttp3:okhttp:4.9.0") - implementation ("com.squareup.okhttp:okhttp-urlconnection:2.2.0") +// implementation ("com.squareup.okhttp3:okhttp:4.10.0") +// implementation ("com.squareup.okhttp:okhttp-urlconnection:2.2.0") implementation ("org.greenrobot:eventbus:3.2.0") implementation ("com.tencent.bugly:crashreport:latest.release") diff --git a/manager/app/proguard-rules.pro b/manager/app/proguard-rules.pro index 637f1ece72d7..2548233e3b4a 100644 --- a/manager/app/proguard-rules.pro +++ b/manager/app/proguard-rules.pro @@ -13,16 +13,48 @@ -dontwarn org.openjsse.javax.net.ssl.** -dontwarn org.openjsse.net.ssl.** +# 保留androidx下的所有类及其内部类 +#-keep class androidx.** {*;} +#-keep public class * extends androidx.** +#-keep interface androidx.** {*;} + + + ## ---------Retrofit混淆方法--------------- -dontwarn javax.annotation.** -dontwarn javax.inject.** # OkHttp3 -dontwarn okhttp3.logging.** --keep class okhttp3.internal.**{*;} +-keep class okhttp3.**{*;} +-keep class okhttp3.** { *; } +-dontwarn com.squareup.okhttp3.** +-keep class com.squareup.okhttp3.** { *;} + +-dontwarn com.squareup.** -dontwarn okio.** +-keep public class org.codehaus.* { *; } +-keep public class java.nio.* { *; } + # Retrofit --dontwarn retrofit2.** --keep class retrofit2.** { *; } +-keepattributes Signature, InnerClasses, EnclosingMethod +-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations +-keepattributes AnnotationDefault +-keepclassmembers,allowshrinking,allowobfuscation interface * { + @retrofit2.http.* ; +} +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement +-dontwarn javax.annotation.** +-dontwarn kotlin.Unit +-dontwarn retrofit2.KotlinExtensions +-dontwarn retrofit2.KotlinExtensions$* +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface <1> +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface * extends <1> +-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation +-if interface * { @retrofit2.http.* public *** *(...); } +-keep,allowoptimization,allowshrinking,allowobfuscation class <3> + -keepattributes Signature -keepattributes Exceptions # RxJava RxAndroid @@ -31,6 +63,7 @@ long producerIndex; long consumerIndex; } + -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef { rx.internal.util.atomic.LinkedQueueNode producerNode; } @@ -43,7 +76,13 @@ -keepattributes Signature # RxJava2 -dontwarn io.reactivex.** +-keepclasseswithmembers class * { +@retrofit2.* ; +} +-keepclasseswithmembers interface * { +@retrofit2.* ; +} # RxJava2: If you are using RxAndroid (e.g. AndroidSchedulers) -dontwarn io.reactivex.android.** @@ -56,9 +95,11 @@ # Gson -keep class com.google.gson.stream.** { *; } -keepattributes EnclosingMethod +-keep class com.google.gson.** { *; } # Gson -keep class me.weishu.kernelsu.bean.**{*;} # 自定义数据模型的bean目录 +-keep class me.weishu.kernelsu.net.CommonService # 自定义数据模型的bean目录 #eventbus -keepattributes *Annotation* diff --git a/manager/app/src/main/java/me/weishu/kernelsu/net/BaseRetrofitManager.java b/manager/app/src/main/java/me/weishu/kernelsu/net/BaseRetrofitManager.java index e3980ca29a3a..5c879fd996d0 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/net/BaseRetrofitManager.java +++ b/manager/app/src/main/java/me/weishu/kernelsu/net/BaseRetrofitManager.java @@ -7,11 +7,11 @@ import me.weishu.kernelsu.net.interceptor.HttpUrlInterceptor; import okhttp3.OkHttpClient; -import okhttp3.logging.HttpLoggingInterceptor; + import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; -import retrofit2.converter.scalars.ScalarsConverterFactory; + /** * @author: ji xin @@ -30,8 +30,8 @@ public class BaseRetrofitManager { private OkHttpClient getOkHttpClient() { - HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); - interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); +// HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); +// interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); // // File cacheFile = new File(BaseApplication.getContext().getCacheDir(), "cache"); @@ -42,7 +42,7 @@ private OkHttpClient getOkHttpClient() { .connectTimeout(CONNECT_TIME_OUT, TimeUnit.SECONDS) // .addInterceptor(interceptor) .addInterceptor(new HttpUrlInterceptor()) - .addNetworkInterceptor(interceptor) +// .addNetworkInterceptor(interceptor) // .cache(cache) .build(); return okHttpClient; @@ -53,7 +53,7 @@ protected Retrofit getRetrofit() { Gson gson = GsonUtils.createGson(true).setLenient().create(); retrofit = new Retrofit.Builder() .client(getOkHttpClient()) - .addConverterFactory(ScalarsConverterFactory.create()) + .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(BASE_URL) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/net/CommonRetrofitManager.java b/manager/app/src/main/java/me/weishu/kernelsu/net/CommonRetrofitManager.java index d60bc36d35e9..ea9a143762b6 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/net/CommonRetrofitManager.java +++ b/manager/app/src/main/java/me/weishu/kernelsu/net/CommonRetrofitManager.java @@ -14,8 +14,13 @@ public class CommonRetrofitManager extends BaseRetrofitManager { private CommonService mCommonService; public CommonRetrofitManager() { - //构造函数获取retrofit对象,并创建接口类的对象,拿到这个对象,可以调用具体的接口 - mCommonService = getRetrofit().create(CommonService.class); + try{ + //构造函数获取retrofit对象,并创建接口类的对象,拿到这个对象,可以调用具体的接口 + mCommonService = getRetrofit().create(CommonService.class); + }catch (Exception e){ + e.printStackTrace(); + } + } private static class SingletonHolder { diff --git a/manager/gradle.properties b/manager/gradle.properties index 3b2c14c0d754..edd381dcef6e 100644 --- a/manager/gradle.properties +++ b/manager/gradle.properties @@ -3,5 +3,5 @@ android.enableAppCompileTimeRClass=true android.useAndroidX=true #org.gradle.parallel=true #org.gradle.vfs.watch=true -#org.gradle.jvmargs=-Xmx2048m +#org.gradle.jvmargs=-Xmx8096m #android.native.buildOutput=verbose \ No newline at end of file