第一次提交

This commit is contained in:
jjLv 2025-07-25 15:55:36 +08:00
parent 8a348629fc
commit 7f2e724df3
8 changed files with 630 additions and 0 deletions

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

179
app/build.gradle Normal file
View File

@ -0,0 +1,179 @@
apply plugin: 'com.android.application'
apply plugin: 'img-optimizer'
//true启用
if (isNeedPackage.toBoolean() && isUseBooster.toBoolean()) {
apply plugin: 'com.didiglobal.booster'
}
android {
compileSdk 30
defaultConfig {
applicationId "org.easydarwin.easypusher"
minSdk 29
targetSdk 30
versionCode 1
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
ndk {
abiFilters "arm64-v8a","armeabi-v7a"
}
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
arguments = [ moduleName : project.getName(),
"room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
}
signingConfigs {
if (isNeedPackage.toBoolean()) {
release {
storeFile file(app_release.storeFile)
storePassword app_release.storePassword
keyAlias app_release.keyAlias
keyPassword app_release.keyPassword
}
}
debug {
storeFile file("./debug.jks")
storePassword "123456"
keyAlias "debug"
keyPassword "123456"
}
release {
//moudle文件夹为根路径的project
storeFile file("../ks.jks")
storePassword "123456"
keyAlias "key0"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (isNeedPackage.toBoolean()) {
signingConfig signingConfigs.release
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def appID = properties.getProperty("APP_ID_UMENG")
if (appID != null) {
buildConfigField "String", "APP_ID_UMENG", appID
} else {
buildConfigField "String", "APP_ID_UMENG", '""'
}
} else {
signingConfig signingConfigs.debug
buildConfigField "String", "APP_ID_UMENG", '""'
}
}
debug {
debuggable true
minifyEnabled false
signingConfig signingConfigs.debug
buildConfigField "String", "APP_ID_UMENG", '""'
}
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation fileTree(dir: 'lib', include: ['*.jar', '*.aar'])
testImplementation deps.junit
androidTestImplementation deps.runner
androidTestImplementation deps.espresso.core
//
implementation deps.androidx.multidex
implementation 'com.alibaba.android:vlayout:1.3.0'
//
implementation 'io.github.scwang90:refresh-layout-kernel:2.0.6'
implementation 'io.github.scwang90:refresh-header-material:2.0.6'
//WebView
implementation 'com.github.xuexiangjys.AgentWeb:agentweb-core:1.0.1'
implementation 'com.github.xuexiangjys.AgentWeb:agentweb-download:1.0.1'//
//mmkv
implementation 'com.tencent:mmkv:1.2.10'
//AutoSize
implementation 'me.jessyan:autosize:1.2.1'
//umeng统计
implementation 'com.umeng.umsdk:common:9.3.8'
implementation 'com.umeng.umsdk:asms:1.2.1'
//
implementation 'me.samlss:broccoli:1.0.0'
implementation 'com.zzhoujay.richtext:richtext:3.0.8'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
//ANR异常捕获
implementation 'com.github.anrwatchdog:anrwatchdog:1.4.0'
//
implementation 'com.meituan.android.walle:library:1.1.6'
implementation 'com.jakewharton:butterknife:10.2.0'
implementation 'com.github.getActivity:XXPermissions:13.5'
implementation 'cn.hutool:hutool-all:5.8.22'
// https://mvnrepository.com/artifact/com.alibaba/fastjson
implementation group: 'com.alibaba', name: 'fastjson', version: '2.0.56'
// build.gradle dakewharton.threetenabp:threetenabp:1.4.0'
implementation 'androidx.room:room-common:2.3.0'
implementation "androidx.room:room-runtime:2.3.0" // Room
annotationProcessor "androidx.room:room-compiler:2.3.0" // Java
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
implementation 'com.google.guava:guava:31.1-android' // Android
implementation 'com.github.NewHuLe:AppUpdate:v1.7'
// https://mvnrepository.com/artifact/org.rxtx/rxtx
implementation("org.rxtx:rxtx:2.1.7")
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.licheedev:android-serialport:2.1.3'
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3'
implementation 'org.bouncycastle:bcprov-jdk15to18:1.77'
}
//X-Library依赖
apply from: 'x-library.gradle'
//walle多渠道打包
apply from: 'multiple-channel.gradle'

25
app/channel Normal file
View File

@ -0,0 +1,25 @@
# 美团
meituan
# 三星
samsungapps
# 小米
xiaomi
# 91助手
91com
# 魅族
meizu
# 豌豆荚
wandou
# Google Play
googleplay
# 百度
baidu
# 360
360cn
# 应用宝
myapp
# 华为
huawei
# 蒲公英
pgyer
github

BIN
app/debug.jks Normal file

Binary file not shown.

View File

@ -0,0 +1,10 @@
apply plugin: 'walle'
walle {
//
apkOutputFolder = new File("${project.buildDir}/outputs/channels")
// APK的文件名称
apkFileNameFormat = '${appName}-${packageName}-${channel}-${buildType}-v${versionName}-${versionCode}-${buildTime}.apk'
//
channelFile = new File("${project.getProjectDir()}/channel")
}

314
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,314 @@
#=========================================基础不变的混淆配置=========================================##
#指定代码的压缩级别
-optimizationpasses 5
#包名不混合大小写
-dontusemixedcaseclassnames
#不去忽略非公共的库类
-dontskipnonpubliclibraryclasses
# 指定不去忽略非公共的库的类的成员
-dontskipnonpubliclibraryclassmembers
#优化 不优化输入的类文件
-dontoptimize
#预校验
-dontpreverify
#混淆时是否记录日志
-verbose
# 混淆时所采用的算法
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
#保护注解
-keepattributes *Annotation*
#忽略警告
-ignorewarnings
# 保留 Room 的相关类
-keep class androidx.room.** { *; }
-keep class androidx.sqlite.db.** { *; }
-keep class * extends androidx.room.RoomDatabase {
public static <methods>;
}
-keep class * extends androidx.room.Entity {
public static <methods>;
}
##记录生成的日志数据,gradle build时在本项目根目录输出##
#apk 包内所有 class 的内部结构
-dump class_files.txt
#未混淆的类和成员
-printseeds seeds.txt
#列出从 apk 中删除的代码
-printusage unused.txt
#混淆前后的映射
-printmapping mapping.txt
# 并保留源文件名为"Proguard"字符串,而非原始的类名 并保留行号
-keepattributes SourceFile,LineNumberTable
########记录生成的日志数据gradle build时 在本项目根目录输出-end#####
#需要保留的东西
# 保持哪些类不被混淆
-keep public class * extends android.app.Fragment
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-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.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.**
-keep public class com.android.vending.licensing.ILicensingService
#如果有引用v4包可以添加下面这行
-keep public class * extends android.support.v4.app.Fragment
##########JS接口类不混淆,否则执行不了
-dontwarn com.android.JsInterface.**
-keep class com.android.JsInterface.** {*; }
#极光推送和百度lbs android sdk一起使用proguard 混淆的问题#http的类被混淆后导致apk定位失败保持apache 的http类不被混淆就好了
-dontwarn org.apache.**
-keep class org.apache.**{ *; }
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
#保持 native 方法不被混淆
-keepclasseswithmembernames class * {
native <methods>;
}
#保持自定义控件类不被混淆
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
#保持自定义控件类不被混淆
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
#保持 Parcelable 不被混淆
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
#保持 Serializable 不被混淆
-keepnames class * implements java.io.Serializable
#保持 Serializable 不被混淆并且enum 类也不被混淆
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
!private <fields>;
!private <methods>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
#保持枚举 enum 类不被混淆 如果混淆报错,建议直接使用上面的 -keepclassmembers class * implements java.io.Serializable即可
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class * {
public void *ButtonClicked(android.view.View);
}
#不混淆资源类
-keep class **.R$* {*;}
#===================================混淆保护自己项目的部分代码以及引用的第三方jar包library=============================#######
#如果引用了v4或者v7包
-dontwarn android.support.**
# AndroidX 防止混淆
-dontwarn com.google.android.material.**
-dontnote com.google.android.material.**
-dontwarn androidx.**
-keep class com.google.android.material.** {*;}
-keep class androidx.** {*;}
-keep public class * extends androidx.**
-keep interface androidx.** {*;}
-keepclassmembers class * {
@androidx.annotation.Keep *;
}
# zxing
-dontwarn com.google.zxing.**
-keep class com.google.zxing.**{*;}
#SignalR推送
-keep class microsoft.aspnet.signalr.** { *; }
# 极光推送混淆
-dontoptimize
-dontpreverify
-dontwarn cn.jpush.**
-keep class cn.jpush.** { *; }
-dontwarn cn.jiguang.**
-keep class cn.jiguang.** { *; }
# 数据库框架OrmLite
-keepattributes *DatabaseField*
-keepattributes *DatabaseTable*
-keepattributes *SerializedName*
-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
-keepclassmembers enum com.j256.** { *; }
-keep interface com.j256.**
-keepclassmembers interface com.j256.** { *; }
#XHttp2
-keep class com.xuexiang.xhttp2.model.** { *; }
-keep class com.xuexiang.xhttp2.cache.model.** { *; }
-keep class com.xuexiang.xhttp2.cache.stategy.**{*;}
-keep class com.xuexiang.xhttp2.annotation.** { *; }
#okhttp
-dontwarn com.squareup.okhttp3.**
-keep class com.squareup.okhttp3.** { *;}
-dontwarn okio.**
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-dontwarn javax.annotation.**
#如果用到Gson解析包的直接添加下面这几行就能成功混淆不然会报错
-keepattributes Signature
-keep class com.google.gson.stream.** { *; }
-keepattributes EnclosingMethod
-keep class org.xz_sale.entity.**{*;}
-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.** { *; }
# Glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
# Retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Exceptions
# RxJava RxAndroid
-dontwarn sun.misc.**
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
rx.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
-dontwarn okio.**
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault
-dontwarn javax.annotation.**
# fastjson
-dontwarn com.alibaba.fastjson.**
-keep class com.alibaba.fastjson.** { *; }
-keepattributes Signature
# xpage
-keep class com.xuexiang.xpage.annotation.** { *; }
-keep class com.xuexiang.xpage.config.** { *; }
# xaop
-keep @com.xuexiang.xaop.annotation.* class * {*;}
-keep @org.aspectj.lang.annotation.* class * {*;}
-keep class * {
@com.xuexiang.xaop.annotation.* <fields>;
@org.aspectj.lang.annotation.* <fields>;
}
-keepclassmembers class * {
@com.xuexiang.xaop.annotation.* <methods>;
@org.aspectj.lang.annotation.* <methods>;
}
# xrouter
-keep public class com.xuexiang.xrouter.routes.**{*;}
-keep class * implements com.xuexiang.xrouter.facade.template.ISyringe{*;}
# 如果使用了 byType 的方式获取 Service,需添加下面规则,保护接口
-keep interface * implements com.xuexiang.xrouter.facade.template.IProvider
# 如果使用了 单类注入,即不定义接口实现 IProvider,需添加下面规则,保护实现
-keep class * implements com.xuexiang.xrouter.facade.template.IProvider
# xupdate
-keep class com.xuexiang.xupdate.entity.** { *; }
# xvideo
-keep class com.xuexiang.xvideo.jniinterface.** { *; }
# xipc
-keep @com.xuexiang.xipc.annotation.* class * {*;}
-keep class * {
@com.xuexiang.xipc.annotation.* <fields>;
}
-keepclassmembers class * {
@com.xuexiang.xipc.annotation.* <methods>;
}
# umeng统计
-keep class com.umeng.** {*;}
-keepclassmembers class * {
public <init> (org.json.JSONObject);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class com.xuexiang.xui.widget.edittext.materialedittext.** { *; }
# 保留所有 JNI 接口类方法和字段
-keep class com.arcsoft.** { *; } # 替换为虹软 SDK 的实际包名
# 保留所有 Native 方法
-keepclasseswithmembernames class * {
native <methods>;
}
# 保留 JNI 调用的类和方法(如果存在动态注册)
-keepclasseswithmembers class * {
public static native void JNI_OnLoad(...);
public static native void JNI_OnUnload(...);
}
# 保留类中的静态字段(如果 JNI 需要访问静态字段)
-keepclassmembers class * {
static ** JNI_*;
}
# 保留模型类
-keep class com.bonus.canteen.** { *; }
# 保留 FastJSON 注解
-keepattributes *Annotation*
-keep class * implements com.alibaba.fastjson.annotation.JSONType { *; }
# 保留无参构造方法
-keepclassmembers class * {
public <init>();
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2025 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.bonus.canteen;
import com.bonus.canteen.core.http.entity.TipInfo;
import com.xuexiang.xhttp2.model.ApiResult;
import com.xuexiang.xutil.net.JsonUtil;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
TipInfo info = new TipInfo();
info.setTitle("微信公众号");
info.setContent("获取更多资讯欢迎关注我的微信公众号【我的Android开源之旅】");
List<TipInfo> list = new ArrayList<>();
for (int i = 0; i <5 ; i++) {
list.add(info);
}
ApiResult<List<TipInfo>> result = new ApiResult<>();
result.setData(list);
System.out.println(JsonUtil.toJson(result));
}
}

48
app/x-library.gradle Normal file
View File

@ -0,0 +1,48 @@
apply plugin: 'com.xuexiang.xaop' //XAOP插件
apply plugin: 'com.xuexiang.xrouter' //XRouter-plugin插件实现自动注册
//
configurations.each { configuration ->
def dependencies = getProject().dependencies
if (configuration.name == "implementation") {
//Project加入X-Library依赖
//XUI框架
configuration.dependencies.add(dependencies.create(deps.xlibrary.xui))
configuration.dependencies.add(dependencies.create(deps.androidx.appcompat))
configuration.dependencies.add(dependencies.create(deps.androidx.recyclerview))
configuration.dependencies.add(dependencies.create(deps.androidx.design))
configuration.dependencies.add(dependencies.create(deps.glide))
//XUtil工具类
configuration.dependencies.add(dependencies.create(deps.xlibrary.xutil_core))
//XAOP切片
configuration.dependencies.add(dependencies.create(deps.xlibrary.xaop_runtime))
//XUpdate版本更新
configuration.dependencies.add(dependencies.create(deps.xlibrary.xupdate))
//XHttp2
configuration.dependencies.add(dependencies.create(deps.xlibrary.xhttp2))
configuration.dependencies.add(dependencies.create(deps.rxjava2))
configuration.dependencies.add(dependencies.create(deps.rxandroid))
configuration.dependencies.add(dependencies.create(deps.okhttp3))
configuration.dependencies.add(dependencies.create(deps.gson))
//XPage
configuration.dependencies.add(dependencies.create(deps.xlibrary.xpage_lib))
//
configuration.dependencies.add(dependencies.create(deps.xlibrary.xrouter_runtime))
}
if (configuration.name == "annotationProcessor") {
//XPage
configuration.dependencies.add(dependencies.create(deps.xlibrary.xpage_compiler))
//
configuration.dependencies.add(dependencies.create(deps.xlibrary.xrouter_compiler))
}
if (configuration.name == "debugImplementation") {
//leak
configuration.dependencies.add(dependencies.create(deps.leakcanary))
}
}
configurations.all {
resolutionStrategy.force deps.okhttp3
}