build: 版本兼容升级
1. agp -> v8.1.0 2. gradle -> v8.0 3. 添加 gradle version catalogs 管理依赖,替换 buildSrc 方式,目前只将插件部分重构,其余依赖后续版本中重构
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
|
||||
## Demo
|
||||
|
||||
以鸿洋大神的玩安卓开放Api做的一款极简风格的玩安卓,仓库地址:[WanAndroidMVVM](https://github.com/Quyunshuo/WanAndroidMVVM),该项目正在开发中,由于工作较忙需要一段时间才能完成。如果想看旧版本的demo,可以直接打开demo分支看。
|
||||
以鸿洋大神的玩安卓开放Api做了简单的页面示例,仓库地址:[WanAndroidMVVM](https://github.com/Quyunshuo/WanAndroidMVVM)
|
||||
|
||||
## 框架图示
|
||||
|
||||
@ -387,5 +387,4 @@ fun test() {
|
||||
|
||||
三方库源码笔记(13)-可能是全网第一篇 Coil 的源码分析文章:[https://juejin.cn/post/6897872882051842061](https://juejin.cn/post/6897872882051842061)
|
||||
|
||||
【奇技淫巧】新的图片加载库?基于Kotlin协程的图片加载库——Coil:[https://juejin.cn/post/6844904159527829518](https://juejin.cn/post/6844904159527829518)
|
||||
|
||||
【奇技淫巧】新的图片加载库?基于Kotlin协程的图片加载库——Coil:[https://juejin.cn/post/6844904159527829518](https://juejin.cn/post/6844904159527829518)
|
||||
@ -4,28 +4,31 @@
|
||||
|
||||
import com.quyunshuo.androidbaseframemvvm.buildsrc.*
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'dagger.hilt.android.plugin'
|
||||
plugins {
|
||||
alias(libs.plugins.application)
|
||||
alias(libs.plugins.kotlin)
|
||||
alias(libs.plugins.hilt)
|
||||
id "kotlin-kapt"
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion ProjectBuildConfig.compileSdkVersion
|
||||
namespace 'com.quyunshuo.androidbaseframemvvm'
|
||||
compileSdk ProjectBuildConfig.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
applicationId ProjectBuildConfig.applicationId
|
||||
minSdkVersion ProjectBuildConfig.minSdkVersion
|
||||
targetSdkVersion ProjectBuildConfig.targetSdkVersion
|
||||
minSdk ProjectBuildConfig.minSdkVersion
|
||||
targetSdk ProjectBuildConfig.targetSdkVersion
|
||||
versionCode ProjectBuildConfig.versionCode
|
||||
versionName ProjectBuildConfig.versionName
|
||||
|
||||
testInstrumentationRunner DependencyConfig.AndroidX.AndroidJUnitRunner
|
||||
multiDexKeepProguard file("multidexKeep.pro")
|
||||
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
//abiFilters 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86','x86_64'
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,14 +77,13 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
jvmTarget = '17'
|
||||
}
|
||||
namespace 'com.quyunshuo.androidbaseframemvvm'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
39
app/proguard-rules.pro
vendored
39
app/proguard-rules.pro
vendored
@ -1,27 +1,20 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
# 避免 ViewBinding 类被混淆导致反射初始化失败
|
||||
-keep public interface androidx.viewbinding.ViewBinding
|
||||
-keepclassmembers class * implements androidx.viewbinding.ViewBinding{
|
||||
*;
|
||||
}
|
||||
}
|
||||
|
||||
# AGP 8.x 警告生成
|
||||
# Please add these rules to your existing keep rules in order to suppress warnings.
|
||||
# This is generated automatically by the Android Gradle plugin.
|
||||
-dontwarn dalvik.system.VMStack
|
||||
-dontwarn javax.lang.model.element.Element
|
||||
-dontwarn org.bouncycastle.jsse.BCSSLParameters
|
||||
-dontwarn org.bouncycastle.jsse.BCSSLSocket
|
||||
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
|
||||
-dontwarn org.conscrypt.Conscrypt$Version
|
||||
-dontwarn org.conscrypt.Conscrypt
|
||||
-dontwarn org.conscrypt.ConscryptHostnameVerifier
|
||||
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
|
||||
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
|
||||
-dontwarn org.openjsse.net.ssl.OpenJSSE
|
||||
@ -4,11 +4,6 @@
|
||||
|
||||
import com.quyunshuo.androidbaseframemvvm.buildsrc.*
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'dagger.hilt.android.plugin'
|
||||
|
||||
android {
|
||||
compileSdkVersion ProjectBuildConfig.compileSdkVersion
|
||||
|
||||
@ -28,12 +23,12 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
@ -4,22 +4,12 @@
|
||||
|
||||
import com.quyunshuo.androidbaseframemvvm.buildsrc.*
|
||||
|
||||
if (ProjectBuildConfig.isAppMode) {
|
||||
apply plugin: 'com.android.application'
|
||||
} else {
|
||||
apply plugin: 'com.android.library'
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'dagger.hilt.android.plugin'
|
||||
|
||||
android {
|
||||
compileSdkVersion ProjectBuildConfig.compileSdkVersion
|
||||
compileSdk ProjectBuildConfig.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion ProjectBuildConfig.minSdkVersion
|
||||
targetSdkVersion ProjectBuildConfig.targetSdkVersion
|
||||
minSdk ProjectBuildConfig.minSdkVersion
|
||||
targetSdk ProjectBuildConfig.targetSdkVersion
|
||||
versionCode ProjectBuildConfig.versionCode
|
||||
versionName ProjectBuildConfig.versionName
|
||||
testInstrumentationRunner DependencyConfig.AndroidX.AndroidJUnitRunner
|
||||
@ -32,12 +22,12 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
|
||||
28
build.gradle
28
build.gradle
@ -1,28 +0,0 @@
|
||||
import com.quyunshuo.androidbaseframemvvm.buildsrc.*
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.google.com' }
|
||||
}
|
||||
dependencies {
|
||||
classpath ProjectPluginManager.AndroidToolsPlugin
|
||||
classpath ProjectPluginManager.KotlinPlugin
|
||||
classpath ProjectPluginManager.ARouterRegister
|
||||
classpath ProjectPluginManager.HiltPlugin
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
8
build.gradle.kts
Normal file
8
build.gradle.kts
Normal file
@ -0,0 +1,8 @@
|
||||
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
|
||||
plugins {
|
||||
alias(libs.plugins.application) apply false
|
||||
alias(libs.plugins.library) apply false
|
||||
alias(libs.plugins.kotlin) apply false
|
||||
alias(libs.plugins.hilt) apply false
|
||||
}
|
||||
true // Needed to make the Suppress annotation work for the plugins block
|
||||
@ -1,2 +1,2 @@
|
||||
plugins { `kotlin-dsl` }
|
||||
repositories { jcenter() }
|
||||
repositories { mavenCentral() }
|
||||
@ -22,8 +22,8 @@ object DependencyConfig {
|
||||
const val ConstraintLayout = "2.1.3" // 约束布局
|
||||
const val TestExtJunit = "1.1.2"
|
||||
const val TestEspresso = "3.3.0"
|
||||
const val ActivityKtx = "1.4.0"
|
||||
const val FragmentKtx = "1.4.1"
|
||||
const val ActivityKtx = "1.5.1"
|
||||
const val FragmentKtx = "1.5.2"
|
||||
const val MultiDex = "2.0.1"
|
||||
|
||||
// Android---------------------------------------------------------------
|
||||
@ -35,8 +35,8 @@ object DependencyConfig {
|
||||
const val Coroutines = "1.6.1" // 协程
|
||||
|
||||
// JetPack---------------------------------------------------------------
|
||||
const val Lifecycle = "2.4.1" // Lifecycle相关(ViewModel & LiveData & Lifecycle)
|
||||
const val Hilt = "2.38.1" // DI框架-Hilt
|
||||
const val Lifecycle = "2.4.1" // Lifecycle
|
||||
const val Hilt = "2.44" // DI框架-Hilt
|
||||
|
||||
// GitHub----------------------------------------------------------------
|
||||
const val OkHttp = "4.9.0" // OkHttp
|
||||
|
||||
@ -7,10 +7,10 @@ package com.quyunshuo.androidbaseframemvvm.buildsrc
|
||||
* @since 4/24/21 5:56 PM
|
||||
*/
|
||||
object ProjectBuildConfig {
|
||||
const val compileSdkVersion = 31
|
||||
const val compileSdkVersion = 33
|
||||
const val applicationId = "com.quyunshuo.androidbaseframemvvm"
|
||||
const val minSdkVersion = 21
|
||||
const val targetSdkVersion = 31
|
||||
const val targetSdkVersion = 33
|
||||
const val versionCode = 1
|
||||
const val versionName = "1.0"
|
||||
const val isAppMode = false
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
package com.quyunshuo.androidbaseframemvvm.buildsrc
|
||||
|
||||
/**
|
||||
* 项目级插件管理
|
||||
*
|
||||
* @author Qu Yunshuo
|
||||
* @since 4/24/21 5:56 PM
|
||||
*/
|
||||
object ProjectPluginManager {
|
||||
const val AndroidToolsPlugin = "com.android.tools.build:gradle:7.2.0"
|
||||
const val KotlinPlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
|
||||
const val ARouterRegister = "com.alibaba:arouter-register:1.0.2"
|
||||
const val HiltPlugin = "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
|
||||
}
|
||||
@ -18,4 +18,7 @@ android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
kotlin.code.style=official
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonFinalResIds=false
|
||||
20
gradle/libs.versions.toml
Normal file
20
gradle/libs.versions.toml
Normal file
@ -0,0 +1,20 @@
|
||||
[versions]
|
||||
# plugin
|
||||
agp = "8.1.0"
|
||||
kotlin-android = "1.8.0"
|
||||
hilt = "2.44"
|
||||
|
||||
#lib
|
||||
|
||||
|
||||
[libraries]
|
||||
|
||||
|
||||
[plugins]
|
||||
application = { id = "com.android.application", version.ref = "agp" }
|
||||
library = { id = "com.android.library", version.ref = "agp" }
|
||||
kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-android" }
|
||||
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
|
||||
|
||||
|
||||
[bundles]
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
|
||||
@ -2,8 +2,14 @@
|
||||
//********** lib_base 的配置文件 ***********
|
||||
//****************************************
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.library)
|
||||
alias(libs.plugins.kotlin)
|
||||
alias(libs.plugins.hilt)
|
||||
id "kotlin-kapt"
|
||||
}
|
||||
|
||||
apply from: '../base_lib.gradle'
|
||||
apply plugin: 'dagger.hilt.android.plugin'
|
||||
|
||||
import com.quyunshuo.androidbaseframemvvm.buildsrc.*
|
||||
|
||||
|
||||
@ -2,6 +2,13 @@
|
||||
//********* lib_common 的配置文件 **********
|
||||
//****************************************
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.library)
|
||||
alias(libs.plugins.kotlin)
|
||||
alias(libs.plugins.hilt)
|
||||
id "kotlin-kapt"
|
||||
}
|
||||
|
||||
apply from: '../base_lib.gradle'
|
||||
|
||||
import com.quyunshuo.androidbaseframemvvm.buildsrc.*
|
||||
|
||||
@ -1,7 +1,20 @@
|
||||
import com.quyunshuo.androidbaseframemvvm.buildsrc.ProjectBuildConfig
|
||||
|
||||
//****************************************
|
||||
//******** module_home 的配置文件 *********
|
||||
//****************************************
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin)
|
||||
alias(libs.plugins.hilt)
|
||||
id "kotlin-kapt"
|
||||
}
|
||||
if (ProjectBuildConfig.isAppMode) {
|
||||
apply plugin: 'com.android.application'
|
||||
} else {
|
||||
apply plugin: 'com.android.library'
|
||||
}
|
||||
|
||||
apply from: '../base_module.gradle'
|
||||
|
||||
android {
|
||||
|
||||
@ -1,3 +1,24 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url = java.net.URI.create("https://maven.google.com") }
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url = java.net.URI.create("https://maven.google.com") }
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "AndroidBaseFrameMVVM"
|
||||
|
||||
include(
|
||||
":app",
|
||||
":lib_base",
|
||||
|
||||
Reference in New Issue
Block a user