diff --git a/.gitignore b/.gitignore index 66824cd..2a82f03 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ local.properties .idea/ .git/ +app/build/ diff --git a/README.md b/README.md index 86b7e12..41128bc 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ ## 开发环境 jdk版本: 1.8 - Android API Platform: 29 + Android API Platform: 30 Gradle版本: 6.7.1 ## 使用说明 diff --git a/app/build.gradle b/app/build.gradle index 5184e8e..d0e23b3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,17 +3,53 @@ plugins { } android { + applicationVariants.all { variant -> + variant.outputs.all { output -> + def outputFile = output.outputFile + def fileName + if (outputFile != null && outputFile.name.endsWith('.apk')) { + if (variant.buildType.name.equals('release')) {//如果是release包 + fileName = "MIN_VPN_release_v${defaultConfig.versionName}.apk" + } else if (variant.buildType.name.equals('debug')) {//如果是debug包 + fileName = "MIN_VPN_debug_v${defaultConfig.versionName}.apk" + } + outputFileName = fileName + } + } + } + + // APK导出时需要的身份签名(内含APP所属单位、APP版本号信息) + signingConfigs { + release { + keyAlias 'pkukey' + keyPassword 'pkusz111' + storeFile file('pkukey.jks') + storePassword 'pkusz111' + } + } + compileSdkVersion 30 buildToolsVersion "30.0.3" + sourceSets.main.jniLibs.srcDirs = ['libs'] + defaultConfig { applicationId "com.pkusz.min_vpn_client" minSdkVersion 24 targetSdkVersion 30 - versionCode 1 - versionName "1.0" + versionCode 4 + versionName "4.0.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + + // 解决32位so库的调用问题。https://blog.csdn.net/li_dongcai/article/details/53612634 + // https://www.jianshu.com/p/ad95c885c2f8?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation + ndk{ + abiFilters "armeabi-v7a","x86" + } + packagingOptions { + exclude "lib/arm64-v8a/libsqlitejdbc.so" + } } buildTypes { @@ -25,6 +61,12 @@ android { lintOptions { disable('AllowBackup', 'GoogleAppIndexingWarning', 'MissingApplicationIcon') } + + // 编译所用jdk版本 + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } } dependencies { @@ -33,4 +75,71 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' compileOnly 'com.google.android.things:androidthings:1.0' + + // 以下为旧版本VPN客户端的依赖库(去掉kotlin) + implementation fileTree(dir: "libs", include: ["*.jar"]) +// implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.3.1' + implementation "androidx.appcompat:appcompat:$androidx_base_version" + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation "androidx.recyclerview:recyclerview:$androidx_base_version" + implementation "androidx.security:security-crypto:1.1.0-alpha03" + + implementation "org.jetbrains.anko:anko-commons:$anko_version" + + // 所有的模块都依赖于 quick_android_base (必选) + implementation "com.github.SunnyQjm.quickandroid:quick_android_base:$quick_android_version" + implementation "com.github.SunnyQjm.quickandroid:quick_android_custom_view:$quick_android_version" + implementation "com.github.SunnyQjm.quickandroid:quick_android_easy_bar:$quick_android_version" + // 引入quick_android_mvp模块,来使用网络请求和MVP架构(可选) + implementation "com.github.SunnyQjm.quickandroid:quick_android_mvp:$quick_android_version" + // 引入quick_android_rx_permission模块,来接入链式调用动态请求权限的功能(可选) + implementation "com.github.SunnyQjm.quickandroid:quick_android_rx_permission:$quick_android_version" + // 引入quick_android_qrcode模块,来接入扫码功能(可选) + implementation "com.github.SunnyQjm.quickandroid:quick_android_qrcode:$quick_android_version" + // 引入quick_android_image_picker模块,来接入图片选择,图片裁剪等功能(可选) + implementation "com.github.SunnyQjm.quickandroid:quick_android_image_picker:$quick_android_version" + // 引入文件选择功能(调用系统的文件管理器) + implementation "com.github.SunnyQjm.quickandroid:quick_android_file_picker:$quick_android_version" + + // loading button + implementation 'br.com.simplepass:loading-button-android:2.2.0' + + // AndroidUtilCode + implementation 'com.blankj:utilcodex:1.26.0' + + // 加载动画 + implementation 'com.github.ybq:Android-SpinKit:1.4.0' + + // android-banner + implementation 'com.github.zhpanvip:BannerViewPager:2.6.1' + + // EventBus + implementation 'org.greenrobot:eventbus:3.1.1' + + // SmartRefreshLayout + implementation "com.scwang.smartrefresh:SmartRefreshLayout:$smart_refresh_layout_version" + implementation "com.scwang.smartrefresh:SmartRefreshHeader:$smart_refresh_layout_version" + + + // brvah + implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.49-androidx' + + implementation 'com.google.android.material:material:1.3.0-alpha01' + + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + + implementation 'com.github.bumptech.glide:glide:4.7.1' + //implementation 'me.dm7.barcodescanner:zxing:1.9.13' + implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7' + //implementation 'com.wei.android.lib:fingerprintidentify:1.2.6' + implementation 'co.infinum:goldfinger:2.0.1' + + //验证码空间 + implementation 'com.justkiddingbaby:vercodeedittext:1.1.0' + + //倒计时按钮 + implementation 'com.white.countdownbutton:countdownbtn:1.0.4' } \ No newline at end of file diff --git a/app/libs/min-dev-java-1.0-release.jar b/app/libs/min-dev-java-1.0-release.jar new file mode 100644 index 0000000..0f8e83f Binary files /dev/null and b/app/libs/min-dev-java-1.0-release.jar differ diff --git a/app/pkukey.jks b/app/pkukey.jks new file mode 100644 index 0000000..04ad70c Binary files /dev/null and b/app/pkukey.jks differ diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..2d5c340 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,335 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + + +# 以下是旧版VPN的本配置文件内容 +#---------------------------------基本指令区----------------------- + +-optimizationpasses 5 #指定代码的压缩级别 +-dontpreverify #预校验 +-verbose #指定日志级别 +-dontskipnonpubliclibraryclassmembers +-dontusemixedcaseclassnames #包名不混合大小写 +-ignorewarnings #忽略警告 +-printmapping proguardMapping.txt #生成原类名和混淆后的类名的映射文件 +-optimizations !code/simplification/cast,!field/*,!class/merging/* #混淆时所采用的算法 +-keepattributes *Annotation*,InnerClasses +-keepattributes Signature +-keepattributes SourceFile,LineNumberTable + + +#---------------------------------默认保留区------------------------ + +#四大组件、View体系等 +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Fragment +-keep public class * extends android.support.multidex.MultiDexApplication +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.preference.Preference +-keep public class * extends android.view.View +-keep class android.support.** {*;} +-keep public class * extends android.support.v4.** + +-keep public class * extends android.view.View{ + *** get*(); + void set*(***); + public (android.content.Context); + public (android.content.Context, android.util.AttributeSet); + public (android.content.Context, android.util.AttributeSet, int); +} + +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} + +-keepclasseswithmembers class * { + public (android.content.Context, android.util.AttributeSet); + public (android.content.Context, android.util.AttributeSet, int); +} + +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +#Serializable +-keepclassmembers class * implements java.io.Serializable { + static final long serialVersionUID; + private static final java.io.ObjectStreamField[] serialPersistentFields; + private void writeObject(java.io.ObjectOutputStream); + private void readObject(java.io.ObjectInputStream); + java.lang.Object writeReplace(); + java.lang.Object readResolve(); +} + +-keep class **.R$* { + *; +} + +-keepclassmembers class * { + void *(*Event); +} + +#enum +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keepclasseswithmembernames class * { + native ; +} + +-keepclassmembers class * { + public (org.json.JSONObject); +} + +-keepclasseswithmembernames class * { + native ; +} + +#Parcelable +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +#webview +-keepclassmembers class fqcn.of.javascript.interface.for.Webview { + public *; +} +-keepclassmembers class * extends android.webkit.WebViewClient { + public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap); + public boolean *(android.webkit.WebView, java.lang.String); +} +-keepclassmembers class * extends android.webkit.WebViewClient { + public void *(android.webkit.WebView, jav.lang.String); +} + + +#----------------------------------Kotlin-------------------------------------- + + #kotlin +-keep class kotlin.** { *; } +-keep class kotlin.Metadata { *; } +-dontwarn kotlin.** +-keepclassmembers class **$WhenMappings { + ; +} +-keepclassmembers class kotlin.Metadata { + public ; +} +-assumenosideeffects class kotlin.jvm.internal.Intrinsics { + static void checkParameterIsNotNull(java.lang.Object, java.lang.String); +} +-keep class kotlinx.coroutines.android.** {*;} +# ServiceLoader support +-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {} +-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {} +-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {} +-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {} + +# Most of volatile fields are updated with AFU and should not be mangled +-keepclassmembernames class kotlinx.** { + volatile ; +} + + + +#---------------------------------Support Vx --------------------------------- + +# support-v4 +-dontwarn android.support.v4.** +-keep class android.support.v4.app.** { *; } +-keep interface android.support.v4.app.** { *; } +-keep class android.support.v4.** { *; } +-keep class android.support.v4.** { + ; + ; +} +-keep interface android.support.v4.app.** { + ; + ; +} + +# support-v7 +-dontwarn android.support.v7.** +-keep class android.support.v7.internal.** { *; } +-keep interface android.support.v7.internal.** { *; } +-keep class android.support.v7.** { *; } + +# support design +-dontwarn android.support.design.** +-keep class android.support.design.** { *; } +-keep interface android.support.design.** { *; } +-keep public class android.support.design.R$* { *; } + + + +#---------------------------------androidx------------------------- +-keep class com.google.android.material.** {*;} + +-keep class androidx.** {*;} + +-keep public class * extends androidx.** + +-keep interface androidx.** {*;} + +-dontwarn com.google.android.material.** + +-dontnote com.google.android.material.** + +-dontwarn androidx.** + + +#---------------------------------model and scan and util------------------------- +-keep class cn.qjm253.min_vpn.model.error.** {*;} +-keep public class * extends cn.qjm253.min_vpn.model.error.** +-keep interface cn.qjm253.min_vpn.model.error.** {*;} + +-keep class cn.qjm253.min_vpn.model.event.** {*;} +-keep public class * extends cn.qjm253.min_vpn.model.event.** +-keep interface cn.qjm253.min_vpn.model.event.** {*;} + +-keep class cn.qjm253.min_vpn.model.request.** {*;} +-keep public class * extends cn.qjm253.min_vpn.model.request.** +-keep interface cn.qjm253.min_vpn.model.request.** {*;} + +-keep class cn.qjm253.min_vpn.model.response.** {*;} +-keep public class * extends cn.qjm253.min_vpn.model.response.** +-keep interface cn.qjm253.min_vpn.model.response.** {*;} + +-keep class cn.qjm253.min_vpn.model.info.** {*;} +-keep public class * extends cn.qjm253.min_vpn.model.info.** +-keep interface cn.qjm253.min_vpn.model.info.** {*;} + +#-keep class cn.qjm253.min_vpn.model.** {*;} +# +#-keep public class * extends cn.qjm253.min_vpn.model.** +# +#-keep interface cn.qjm253.min_vpn.model.** {*;} + +#-keep class cn.qjm253.min_vpn.scan.** {*;} +# +#-keep public class * extends cn.qjm253.min_vpn.scan.** +# +#-keep interface cn.qjm253.min_vpn.scan.** {*;} + +#-keep class cn.qjm253.min_vpn.utils.** {*;} +# +#-keep public class * extends cn.qjm253.min_vpn.utils.** +# +#-keep interface cn.qjm253.min_vpn.utils.** {*;} +#-keepattributes Exceptions,InnerClasses,... +#-keep public class cn.qjm253.min_vpn.utils.SafetyInfoUtil { *; } +#-keep public class cn.qjm253.min_vpn.utils.SafetyInfoUtil$* { *; } + +#-keepnames public class cn.qjm253.min_vpn.utils.SafetyInfoUtil, cn.qjm253.min_vpn.utils.SafetyInfoUtil$* { +# public ; +# public ; +#} + +#---------------------------------第三方包------------------------- + +#okhttp3.x +-dontwarn com.squareup.okhttp3.** +-keep class com.squareup.okhttp3.** { *;} +-dontwarn okio.** +-dontwarn com.squareup.okhttp.** +-keep class com.squareup.okhttp.{*;} +-dontwarn javax.annotation.** +-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase +-dontwarn org.codehaus.mojo.animal_sniffer.* +-dontwarn okhttp3.internal.platform.ConscryptPlatform + +#retrofit +-dontwarn retrofit.** +-keep class retrofit.** { *; } +-keepattributes Signature +-keepattributes Exceptions +-dontwarn okio.** + +#Rxjava RxAndroid +-dontwarn rx.* +-dontwarn sun.misc.** + +#Glide +-keep public class * implements com.bumptech.glide.module.GlideModule +-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { + **[] $VALUES; + public *; +} + +#Gson +-keep class com.google.gson.** {*;} +-keep class com.google.**{*;} +-keep class sun.misc.Unsafe { *; } +-keep class com.google.gson.stream.** { *; } +-keep class com.google.gson.examples.android.model.** { *; } + +#Lambda表达式 +-keep class java.lang.invoke.** {*;} +-dontwarn java.lang.invoke.** + + +#eventbus 3.0 +-keepattributes *Annotation* +-keepclassmembers class ** { + @org.greenrobot.eventbus.Subscribe ; +} +-keep enum org.greenrobot.eventbus.ThreadMode { *; } +-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent { + (java.lang.Throwable); +} + +#jackson +-keep @com.fasterxml.jackson.annotation.JsonIgnoreProperties class * { *; } +-keep @com.fasterxml.jackson.annotation.JsonCreator class * { *; } +-keep @com.fasterxml.jackson.annotation.JsonValue class * { *; } +-keep class sun.misc.Unsafe { *; } +-keepattributes *Annotation*,EnclosingMethod,Signature +-keepnames class com.fasterxml.jackson.** { *; } +-dontwarn com.fasterxml.jackson.databind.** +-keep class org.codehaus.** { *; } +-keepclassmembers public final enum org.codehaus.jackson.annotate.JsonAutoDetect$Visibility { + public static final org.codehaus.jackson.annotate.JsonAutoDetect$Visibility *; } + +#百度地图 +-keep class com.baidu.** { *; } + +#虹软 +-keep class com.arcsoft.face.** { *; } + +#Jndn +-keep class net.named_data.jndn.** { *; } + +#commons-codec +-keep class edu.pku.commons.codec.** { *; } + +#nucypher-crypto-oss-master and bouncycastle +-keep class com.nucypher.crypto.** { *; } +-keep class org.bouncycastle.** { *; } + +#xUtils +-keep class com.lidroid.xutils.** { *; } + +#junit +-keep class org.junit.** { *; } +-dontwarn org.junit.** + +-keep class junit.** { *; } +-dontwarn junit.** + +#goldFinger +-keep class co.infinum.goldfinger.** { *; } + +#gmHelper +-keep class org.zz.gmhelper.** {* ;} + + +#logback +-keep class ch.qos.logback.** {* ;} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 9ade2a7..b705c87 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,17 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + ext.quick_android_version = 'v0.1.9' + ext.anko_version = '0.10.8' + ext.smart_refresh_layout_version = '1.1.0' + ext.androidx_base_version = '1.1.0' + ext.room_version = "2.2.3" repositories { + maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'} + maven { url 'http://maven.aliyun.com/nexus/content/groups/public'} + maven { url 'https://jitpack.io' } google() - mavenCentral() +// jcenter() +// mavenCentral() } dependencies { classpath "com.android.tools.build:gradle:4.2.1" @@ -14,9 +23,12 @@ buildscript { allprojects { repositories { + maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'} + maven { url 'http://maven.aliyun.com/nexus/content/groups/public'} + maven { url 'https://jitpack.io' } google() - mavenCentral() - jcenter() // Warning: this repository is going to shut down soon +// mavenCentral() +// jcenter() // Warning: this repository is going to shut down soon } }