Skip to content

Commit

Permalink
#update gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
wumeng1 authored and wumeng1 committed Jun 29, 2021
1 parent 34d872e commit 858045e
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 79 deletions.
44 changes: 32 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,27 @@ MVVM或衍生出来的变种其行为目的都是一致的。

//你可以直接使用
```
implementation "com.github.mirkowu:mvm:$ext.mvm_version" //总仓库
implementation("com.github.mirkowu:mvm:$ext.mvm_version") { //总仓库
exclude group: "com.github.mirkowu.mvm", module: "lib_bugly" //bugly 包含升级SDK 二选一
//exclude group: "com.github.mirkowu.mvm", module: "lib_crash" //bugly 不含升级SDK 二选一
}
```
//也可以按需索取
//也可以按需索取,部分库之间有依赖,请一同依赖
```
implementation "com.github.mirkowu.mvm:lib_base:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_widget:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_network:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_util:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_image:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_webview:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_photo:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_qr:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_upgrade:$ext.mvm_version"
implementation "com.github.mirkowu.mvm:lib_base:$ext.mvm_version" //基础库
implementation "com.github.mirkowu.mvm:lib_widget:$ext.mvm_version" //UI组件库
implementation "com.github.mirkowu.mvm:lib_network:$ext.mvm_version" //网络库
implementation "com.github.mirkowu.mvm:lib_util:$ext.mvm_version" //工具库
implementation "com.github.mirkowu.mvm:lib_image:$ext.mvm_version" //图片加载库(默认glide)
implementation "com.github.mirkowu.mvm:lib_webview:$ext.mvm_version" //X5 + JsBridge 的WebView
implementation "com.github.mirkowu.mvm:lib_photo:$ext.mvm_version" //相册选择库
implementation "com.github.mirkowu.mvm:lib_qr:$ext.mvm_version" //二维码扫描
implementation "com.github.mirkowu.mvm:lib_upgrade:$ext.mvm_version" //版本更新(弹窗和下载安装功能)
implementation "com.github.mirkowu.mvm:lib_stat:$ext.mvm_version" //umeng统计
implementation "com.github.mirkowu.mvm:lib_screen:$ext.mvm_version" //屏幕适配
implementation "com.github.mirkowu.mvm:lib_bugly:$ext.mvm_version" //bugly 包含升级SDK 二选一
// implementation "com.github.mirkowu.mvm:lib_crash:$ext.mvm_version" //bugly 不含升级SDK 二选一
```

你可以在Application的onCreate()中进行对应的初始化
Expand All @@ -45,9 +52,13 @@ MVVM或衍生出来的变种其行为目的都是一致的。
return;
}

//换成你自己的bugly账号
//换成你自己的bugly账号 请根据官方SDK对接,此处只做演示
BuglyManager.init(this, "buglyId", BuildConfig.DEBUG);

//umeng 请根据官方SDK对接,此处只做演示
UmengManager.preInit(this, "60d310388a102159db787693", "umeng", BuildConfig.DEBUG);
UmengManager.init(this, null);

//屏幕适配
AutoSizeManager.getInstance().setConfig(this);

Expand Down Expand Up @@ -78,4 +89,13 @@ MVVM或衍生出来的变种其行为目的都是一致的。

### [Upgrade组件库功能](https://github.com/MirkoWu/MVM/tree/master/lib_upgrade)

### [Screen组件库功能](https://github.com/MirkoWu/MVM/tree/master/lib_screen)

### [Stat组件库功能](https://github.com/MirkoWu/MVM/tree/master/lib_stat)

### [Bugly组件库功能](https://github.com/MirkoWu/MVM/tree/master/lib_bugly)

### [Crash组件库功能](https://github.com/MirkoWu/MVM/tree/master/lib_crash)



39 changes: 31 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ bugly {
appKey = "1b977565-a3ce-4188-9eea-255729b7ddc8"
}

static def getDate() {
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd-HH-mm')
return formattedDate
}

def ext = rootProject.ext
android {
compileSdkVersion ext.compileSdkVersion
Expand Down Expand Up @@ -44,8 +50,13 @@ android {
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release

debuggable false
jniDebuggable false
zipAlignEnabled true
}
}
//AS4.0及以上
Expand All @@ -63,13 +74,22 @@ android {

//支持Java1.8必加
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}

// kotlinOptions {
// jvmTarget = JavaVersion.VERSION_1_8.toString()
// }
kotlinOptions {
jvmTarget = '1.8'
}

// 自定义输出配置
applicationVariants.all { variant ->
def versionName = variant.versionName
def buildTypeName = variant.buildType.name
variant.outputs.all { output ->
outputFileName = "V" + versionName + "_" + getDate() + "_" + buildTypeName + ".apk"
}
}
}

dependencies {
Expand All @@ -78,12 +98,15 @@ dependencies {
implementation "androidx.core:core-ktx:$ext.core_ktx_version"
implementation "androidx.appcompat:appcompat:$ext.appcompat_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

// implementation "com.github.mirkowu:mvm:$ext.mvm_version" //总仓库
// implementation("com.github.mirkowu:mvm:$ext.mvm_version") { //总仓库
// exclude group: "com.github.mirkowu.mvm", module: "lib_bugly"
//// exclude group: "com.github.mirkowu.mvm", module: "lib_crash"
// }
// implementation "com.github.mirkowu.mvm:lib_base:$ext.mvm_version"
// implementation "com.github.mirkowu.mvm:lib_util:$ext.mvm_version"
// implementation "com.github.mirkowu.mvm:lib_widget:$ext.mvm_version"
Expand All @@ -107,9 +130,9 @@ dependencies {
implementation project(path: ':lib_qr')
implementation project(path: ':lib_stat')
implementation project(path: ':lib_upgrade')
implementation project(path: ':lib_screen')
implementation project(path: ':lib_bugly') //bugly 包含升级SDK 二选一
// implementation project(path: ':lib_crash') //bugly 不含升级SDK 二选一
implementation project(path: ':lib_screen')

//检测内测泄露
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.6'
Expand Down
12 changes: 4 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ buildscript {
ext.kotlin_version = '1.5.0'
repositories {
google()
jcenter()
// 阿里云镜像
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
maven { url 'https://jitpack.io' }
//友盟
maven { url 'https://repo1.maven.org/maven2/' }
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

//Bugly
classpath 'com.tencent.bugly:symtabfileuploader:latest.release'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -27,14 +26,11 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
// 阿里云镜像
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }

maven { url 'https://jitpack.io' }
//友盟
maven { url 'https://repo1.maven.org/maven2/' }
Expand All @@ -50,7 +46,7 @@ ext {
targetSdkVersion = 29
compileSdkVersion = 29

mvm_version = '1.0.13'
mvm_version = '1.0.14'
appcompat_version = '1.3.0'
core_ktx_version = '1.5.0'
lifecycle_version = '2.3.1'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
57 changes: 32 additions & 25 deletions lib_base/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

def ext = rootProject.ext
android {
Expand All @@ -25,37 +26,21 @@ android {
resourcePrefix "base_"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
api 'androidx.appcompat:appcompat:1.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.core:core-ktx:$ext.core_ktx_version"
implementation "androidx.appcompat:appcompat:$ext.appcompat_version"
api 'androidx.recyclerview:recyclerview:1.2.1'
//屏幕适配
// api "me.jessyan:autosize:1.2.1"
//smartRefresh核心必须依赖 + 经典刷新头 + 经典加载
api "com.scwang.smart:refresh-layout-kernel:$ext.refresh_version"
api "com.scwang.smart:refresh-header-classics:$ext.refresh_version"
api "com.scwang.smart:refresh-footer-classics:$ext.refresh_version"


// //eventBus
// api "org.greenrobot:eventbus:$rootProject.ext.third_party_key.eventbus"
// //权限库
// api "com.hjq:xxpermissions:$rootProject.ext.third_party_key.xxpermissions"
// //文件下载
// api "com.liulishuo.filedownloader:library:1.7.7"

// RxJava自动解绑
//api 'com.uber.autodispose:autodispose-android-archcomponents:1.4.0'
api "com.uber.autodispose2:autodispose-androidx-lifecycle:$ext.autodispose_version"

// RxJava3
api "io.reactivex.rxjava3:rxjava:$ext.rxjava3_version"
api "io.reactivex.rxjava3:rxandroid:$ext.rxandroid3_version"

// ViewModel
api "androidx.lifecycle:lifecycle-viewmodel:$ext.lifecycle_version"
Expand All @@ -64,6 +49,28 @@ dependencies {
api "androidx.lifecycle:lifecycle-livedata:$ext.lifecycle_version"
api "androidx.lifecycle:lifecycle-livedata-ktx:$ext.lifecycle_version"

// RxJava3
api "io.reactivex.rxjava3:rxjava:$ext.rxjava3_version"
api "io.reactivex.rxjava3:rxandroid:$ext.rxandroid3_version"
// RxJava自动解绑
//api 'com.uber.autodispose:autodispose-android-archcomponents:1.4.0'
api "com.uber.autodispose2:autodispose-androidx-lifecycle:$ext.autodispose_version"

implementation project(':lib_util')
implementation project(':lib_widget')

// SmartRefresh核心必须依赖 + 经典刷新头 + 经典加载
api "com.scwang.smart:refresh-layout-kernel:$ext.refresh_version"
api "com.scwang.smart:refresh-header-classics:$ext.refresh_version"
api "com.scwang.smart:refresh-footer-classics:$ext.refresh_version"

// 屏幕适配
// api "me.jessyan:autosize:1.2.1"

// //eventBus
// api "org.greenrobot:eventbus:$rootProject.ext.third_party_key.eventbus"
// // 权限库
// api "com.hjq:xxpermissions:$rootProject.ext.third_party_key.xxpermissions"
// // 文件下载
// api "com.liulishuo.filedownloader:library:1.7.7"
}
8 changes: 0 additions & 8 deletions lib_crash/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

def ext = rootProject.ext
android {
Expand All @@ -12,7 +11,6 @@ android {
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "proguard-rules.pro"
}

Expand All @@ -33,12 +31,6 @@ android {

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.core:core-ktx:$ext.core_ktx_version"
implementation "androidx.appcompat:appcompat:$ext.appcompat_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

//bugly
api 'com.tencent.bugly:crashreport:latest.release' //其中latest.release指代最新版本号,也可以指定明确的版本号,例如2.3.2
Expand Down
4 changes: 2 additions & 2 deletions lib_image/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
resourcePrefix "image_"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}

Expand Down
8 changes: 6 additions & 2 deletions lib_network/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ android {
resourcePrefix "network_"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib_photo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
resourcePrefix "ivp_"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void onSuccess(Bitmap result) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(PreviewActivity.this, getString(R.string.ivp_save_successed,
Toast.makeText(PreviewActivity.this, getString(R.string.ivp_save_succeed,
saveFile.getAbsoluteFile()), Toast.LENGTH_SHORT).show();
}
});
Expand Down
2 changes: 1 addition & 1 deletion lib_photo/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<string name="ivp_permission_rationale_camera">拍摄照片需要您提供摄像头和存储权限</string>
<string name="ivp_permission_rationale_write_storage">保存拍照图片需要您提供写存储权限</string>
<string name="ivp_save">保存</string>
<string name="ivp_save_successed">已保存至%s</string>
<string name="ivp_save_succeed">已保存至%s</string>
<string name="ivp_save_failed">保存失败</string>
<string name="ivp_pick">选择</string>
<string name="ivp_max_count_more_zero">最大可选数量需大于 0 !</string>
Expand Down
2 changes: 1 addition & 1 deletion lib_photo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<string name="ivp_permission_rationale_write_storage">Storage write permission is needed to save the images.</string>
<string name="ivp_permission_lack">The current application lacks the necessary permissions, which is temporarily unavailable. If necessary, click ok to go to the Settings center for authorization. </string>
<string name="ivp_save">Save</string>
<string name="ivp_save_successed">Saved to %s</string>
<string name="ivp_save_succeed">Saved to %s</string>
<string name="ivp_save_failed">Save failed</string>
<string name="ivp_pick">Pick</string>
<string name="ivp_max_count_more_zero">The maximum optional quantity must be greater than 0 !</string>
Expand Down
8 changes: 6 additions & 2 deletions lib_util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ android {
resourcePrefix "util_"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}
}

Expand Down
Loading

0 comments on commit 858045e

Please sign in to comment.