diff --git a/Lib_Base/.gitignore b/Lib_Base/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/Lib_Base/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/Lib_Base/build.gradle b/Lib_Base/build.gradle
new file mode 100644
index 0000000..7932464
--- /dev/null
+++ b/Lib_Base/build.gradle
@@ -0,0 +1,72 @@
+import com.quyunshuo.androidbaseframemvvm.build.*
+
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-kapt'
+apply plugin: 'dagger.hilt.android.plugin'
+
+android {
+ compileSdkVersion BuildConfig.compileSdkVersion
+ buildToolsVersion BuildConfig.buildToolsVersion
+
+ defaultConfig {
+ minSdkVersion BuildConfig.minSdkVersion
+ targetSdkVersion BuildConfig.targetSdkVersion
+ versionCode BuildConfig.versionCode
+ versionName BuildConfig.versionName
+ testInstrumentationRunner AndroidX.AndroidJUnitRunner
+ consumerProguardFiles "consumer-rules.pro"
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_1_8.toString()
+ }
+}
+
+kapt {
+ arguments {
+ arg("AROUTER_MODULE_NAME", project.getName())
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: "libs", include: ["*.jar"])
+
+ api AndroidX.CoreKtx
+ api AndroidX.AppCompat
+ api AndroidX.ConstraintLayout
+ api AndroidX.ActivityKtx
+ api AndroidX.FragmentKtx
+
+ api Kotlin.Kotlin
+ api Kotlin.CoroutinesCore
+ api Kotlin.CoroutinesAndroid
+
+ api JetPack.LifecycleRuntimeKtx
+ api JetPack.LifecycleViewModel
+ api JetPack.LifecycleViewModelKtx
+ api JetPack.HiltLifecycleViewModel
+ api JetPack.HiltDaggerAndroid
+
+ api GitHub.OkHttp
+ api GitHub.OkHttpInterceptorLogging
+ api GitHub.Retrofit
+ api GitHub.RetrofitConverterGson
+ api GitHub.Gson
+ api GitHub.MMKV
+ api GitHub.AutoSize
+ api GitHub.Glide
+ api GitHub.ARoute
+ api GitHub.RecyclerViewAdapter
+
+ kapt JetPack.HiltDaggerCompiler
+ kapt JetPack.Hilt
+ kapt GitHub.GlideCompiler
+ kapt GitHub.ARouteCompiler
+}
\ No newline at end of file
diff --git a/Lib_Base/consumer-rules.pro b/Lib_Base/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
diff --git a/Lib_Base/proguard-rules.pro b/Lib_Base/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/Lib_Base/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/Lib_Base/src/main/AndroidManifest.xml b/Lib_Base/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..6baad34
--- /dev/null
+++ b/Lib_Base/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+ /
+
\ No newline at end of file
diff --git a/Lib_Base/src/main/java/com/quyunshuo/base/BaseApplication.kt b/Lib_Base/src/main/java/com/quyunshuo/base/BaseApplication.kt
new file mode 100644
index 0000000..8168183
--- /dev/null
+++ b/Lib_Base/src/main/java/com/quyunshuo/base/BaseApplication.kt
@@ -0,0 +1,12 @@
+package com.quyunshuo.base
+
+import android.app.Application
+
+/**
+ * @Author: QuYunShuo
+ * @Time: 2020/8/27
+ * @Class: BaseApplication
+ * @Remark: 自定义Application的基类
+ */
+open class BaseApplication : Application() {
+}
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/Lib_Base/src/main/res/values/colors.xml
similarity index 100%
rename from app/src/main/res/values/colors.xml
rename to Lib_Base/src/main/res/values/colors.xml
diff --git a/app/src/main/res/values/styles.xml b/Lib_Base/src/main/res/values/styles.xml
similarity index 77%
rename from app/src/main/res/values/styles.xml
rename to Lib_Base/src/main/res/values/styles.xml
index fac9291..0eb88fe 100644
--- a/app/src/main/res/values/styles.xml
+++ b/Lib_Base/src/main/res/values/styles.xml
@@ -1,10 +1,11 @@
+
-
-
\ No newline at end of file
+
diff --git a/Lib_Main/.gitignore b/Lib_Main/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/Lib_Main/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/Lib_Main/build.gradle b/Lib_Main/build.gradle
new file mode 100644
index 0000000..0e08090
--- /dev/null
+++ b/Lib_Main/build.gradle
@@ -0,0 +1,5 @@
+apply from: '../moduleBase.gradle'
+
+android {
+ resourcePrefix "main_"
+}
\ No newline at end of file
diff --git a/Lib_Main/consumer-rules.pro b/Lib_Main/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
diff --git a/Lib_Main/proguard-rules.pro b/Lib_Main/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/Lib_Main/proguard-rules.pro
@@ -0,0 +1,21 @@
+# 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
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/quyunshuo/androidbaseframemvvm/ExampleInstrumentedTest.kt b/Lib_Main/src/androidTest/java/com/quyunshuo/main/ExampleInstrumentedTest.kt
similarity index 81%
rename from app/src/androidTest/java/com/quyunshuo/androidbaseframemvvm/ExampleInstrumentedTest.kt
rename to Lib_Main/src/androidTest/java/com/quyunshuo/main/ExampleInstrumentedTest.kt
index 0bdec24..b670c36 100644
--- a/app/src/androidTest/java/com/quyunshuo/androidbaseframemvvm/ExampleInstrumentedTest.kt
+++ b/Lib_Main/src/androidTest/java/com/quyunshuo/main/ExampleInstrumentedTest.kt
@@ -1,4 +1,4 @@
-package com.quyunshuo.androidbaseframemvvm
+package com.quyunshuo.main
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
- assertEquals("com.quyunshuo.androidbaseframemvvm", appContext.packageName)
+ assertEquals("com.quyunshuo.main.test", appContext.packageName)
}
}
\ No newline at end of file
diff --git a/Lib_Main/src/main/AndroidManifest.xml b/Lib_Main/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ac1b4cd
--- /dev/null
+++ b/Lib_Main/src/main/AndroidManifest.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/quyunshuo/androidbaseframemvvm/MainActivity.kt b/Lib_Main/src/main/java/com/quyunshuo/main/MainActivity.kt
similarity index 86%
rename from app/src/main/java/com/quyunshuo/androidbaseframemvvm/MainActivity.kt
rename to Lib_Main/src/main/java/com/quyunshuo/main/MainActivity.kt
index 3364996..3cc56cc 100644
--- a/app/src/main/java/com/quyunshuo/androidbaseframemvvm/MainActivity.kt
+++ b/Lib_Main/src/main/java/com/quyunshuo/main/MainActivity.kt
@@ -1,11 +1,12 @@
-package com.quyunshuo.androidbaseframemvvm
+package com.quyunshuo.main
-import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
+
}
}
\ No newline at end of file
diff --git a/Lib_Main/src/main/java/debug/AndroidManifest.xml b/Lib_Main/src/main/java/debug/AndroidManifest.xml
new file mode 100644
index 0000000..8c008d9
--- /dev/null
+++ b/Lib_Main/src/main/java/debug/AndroidManifest.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/Lib_Main/src/main/res/layout/activity_main.xml
similarity index 54%
rename from app/src/main/res/layout/activity_main.xml
rename to Lib_Main/src/main/res/layout/activity_main.xml
index 4fc2444..0b15a20 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/Lib_Main/src/main/res/layout/activity_main.xml
@@ -6,13 +6,4 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
-
-
\ No newline at end of file
diff --git a/Lib_Main/src/main/res/values/strings.xml b/Lib_Main/src/main/res/values/strings.xml
new file mode 100644
index 0000000..29757b7
--- /dev/null
+++ b/Lib_Main/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ Lib_Main
+
\ No newline at end of file
diff --git a/app/src/test/java/com/quyunshuo/androidbaseframemvvm/ExampleUnitTest.kt b/Lib_Main/src/test/java/com/quyunshuo/main/ExampleUnitTest.kt
similarity index 87%
rename from app/src/test/java/com/quyunshuo/androidbaseframemvvm/ExampleUnitTest.kt
rename to Lib_Main/src/test/java/com/quyunshuo/main/ExampleUnitTest.kt
index 71b9813..e2357c0 100644
--- a/app/src/test/java/com/quyunshuo/androidbaseframemvvm/ExampleUnitTest.kt
+++ b/Lib_Main/src/test/java/com/quyunshuo/main/ExampleUnitTest.kt
@@ -1,4 +1,4 @@
-package com.quyunshuo.androidbaseframemvvm
+package com.quyunshuo.main
import org.junit.Test
diff --git a/README.md b/README.md
index 9268a38..934eab2 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,5 @@
-# Android项目框架(组件化 + Kotlin + MVVM + Jetpack )
\ No newline at end of file
+# Android项目框架(组件化 + Kotlin + MVVM + Jetpack )
+note: 1. 组件间资源命名冲突问题
+ 2. 组件间不同模式下的清单文件及其他
+ 3. 测试打包脚本
+ 4. Application
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index c7d21e5..de0544a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,7 +3,6 @@ import com.quyunshuo.androidbaseframemvvm.build.*
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
-apply plugin: 'kotlin-kapt'
android {
compileSdkVersion BuildConfig.compileSdkVersion
@@ -16,59 +15,63 @@ android {
versionCode BuildConfig.versionCode
versionName BuildConfig.versionName
testInstrumentationRunner AndroidX.AndroidJUnitRunner
+ }
- javaCompileOptions {
- annotationProcessorOptions {
- arguments = [AROUTER_MODULE_NAME: project.getName()]
+// signingConfigs {
+// releaseConfig {
+// storeFile file('')
+// storePassword ""
+// keyAlias ""
+// keyPassword ""
+// }
+// }
+
+ buildTypes {
+ release {
+// signingConfig signingConfigs.releaseConfig
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ applicationVariants.all { variant ->
+ variant.outputs.all { output ->
+ if (outputFileName != null
+ && outputFileName.endsWith('.apk')
+ && 'release' == variant.buildType.name) {
+ outputFileName = "${BuildConfig.applicationId}_${defaultConfig.versionCode}(${defaultConfig.versionName}).apk"
+ }
+ }
+ }
+ }
+ debug {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ applicationVariants.all { variant ->
+ variant.outputs.all { output ->
+ if (outputFileName != null
+ && outputFileName.endsWith('.apk')
+ && 'debug' == variant.buildType.name) {
+ outputFileName = "${BuildConfig.applicationId}_${defaultConfig.versionCode}(${defaultConfig.versionName}).apk"
+ }
+ }
}
}
}
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
}
- viewBinding {
- enabled = true
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
- testImplementation Android.Junit
- implementation AndroidX.CoreKtx
- implementation AndroidX.AppCompat
- implementation AndroidX.ConstraintLayout
- implementation AndroidX.ActivityKtx
- implementation AndroidX.FragmentKtx
- androidTestImplementation AndroidX.TestExtJunit
- androidTestImplementation AndroidX.TestEspresso
-
- implementation Kotlin.Kotlin
- implementation Kotlin.CoroutinesCore
- implementation Kotlin.CoroutinesAndroid
-
- implementation JetPack.LifecycleRuntimeKtx
- implementation JetPack.LifecycleViewModel
- implementation JetPack.LifecycleViewModelKtx
- implementation JetPack.HiltLifecycleViewModel
- implementation JetPack.HiltDaggerAndroid
- kapt JetPack.HiltDaggerCompiler
- kapt JetPack.Hilt
-
- implementation GitHub.OkHttp
- implementation GitHub.OkHttpInterceptorLogging
- implementation GitHub.Retrofit
- implementation GitHub.RetrofitConverterGson
- implementation GitHub.Gson
- implementation GitHub.MMKV
- implementation GitHub.AutoSize
- implementation GitHub.Glide
- kapt GitHub.GlideCompiler
- implementation GitHub.ARoute
- kapt GitHub.ARouteCompiler
- implementation GitHub.RecyclerViewAdapter
+ implementation AndroidX.MultiDex
+ if (!BuildConfig.isAppMode) {
+ implementation project(path: ':Lib_Main')
+ } else {
+ implementation project(path: ':Lib_Base')
+ }
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b9af0ca..e67d0ca 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,19 +3,12 @@
package="com.quyunshuo.androidbaseframemvvm">
-
-
-
-
-
-
-
-
+ android:theme="@style/AppTheme" />
\ No newline at end of file
diff --git a/app/src/main/java/com/quyunshuo/androidbaseframemvvm/AppApplication.kt b/app/src/main/java/com/quyunshuo/androidbaseframemvvm/AppApplication.kt
new file mode 100644
index 0000000..0840a34
--- /dev/null
+++ b/app/src/main/java/com/quyunshuo/androidbaseframemvvm/AppApplication.kt
@@ -0,0 +1,18 @@
+package com.quyunshuo.androidbaseframemvvm
+
+import androidx.multidex.MultiDex
+import com.quyunshuo.base.BaseApplication
+
+/**
+ * @Author: QuYunShuo
+ * @Time: 2020/8/27
+ * @Class: AppApplication
+ * @Remark: 壳App的Application 负责需要写在App包下的初始化逻辑
+ */
+class AppApplication : BaseApplication() {
+
+ override fun onCreate() {
+ super.onCreate()
+ MultiDex.install(this)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index a571e60..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
deleted file mode 100644
index 61da551..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index c41dd28..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
deleted file mode 100644
index db5080a..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index 6dba46d..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
deleted file mode 100644
index da31a87..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index f25a419..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
deleted file mode 100644
index e96783c..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ
diff --git a/build.gradle b/build.gradle
index 34aa573..ffa025a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,6 +10,7 @@ buildscript {
dependencies {
classpath ProjectPluginManager.AndroidToolsPlugin
classpath ProjectPluginManager.KotlinPlugin
+ classpath ProjectPluginManager.DaggerHiltPlugin
}
}
diff --git a/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/BuildConfig.kt b/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/BuildConfig.kt
index 8f73b45..8e5f3e3 100644
--- a/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/BuildConfig.kt
+++ b/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/BuildConfig.kt
@@ -11,4 +11,5 @@ object BuildConfig {
const val targetSdkVersion = 30
const val versionCode = 1
const val versionName = "1.0"
+ const val isAppMode = false
}
\ No newline at end of file
diff --git a/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/DependencyManager.kt b/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/DependencyManager.kt
index 2983ed2..1ac38f8 100644
--- a/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/DependencyManager.kt
+++ b/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/DependencyManager.kt
@@ -12,11 +12,15 @@ object Version {
const val TestEspresso = "3.3.0"
const val ActivityKtx = "1.1.0"
const val FragmentKtx = "1.2.5"
+ const val MultiDex = "2.0.1"
+
// Android---------------------------------------------------------------
const val Junit = "4.13"
+
// Kotlin----------------------------------------------------------------
const val Kotlin = "1.4.0"
const val Coroutines = "1.3.7" // 协程
+
// JetPack---------------------------------------------------------------
const val LifecycleViewModel = "2.2.0"
const val LifecycleRuntimeKtx = "2.2.0"
@@ -24,6 +28,7 @@ object Version {
const val Hilt = "1.0.0-alpha02" // Hilt 依赖注入
const val HiltLifecycleViewModel = "1.0.0-alpha02"
const val HiltDagger = "2.28-alpha"
+
// GitHub----------------------------------------------------------------
const val OkHttp = "3.14.9" // OkHttp
const val OkHttpInterceptorLogging = "3.12.0" // OkHttp 请求Log拦截器
@@ -48,6 +53,7 @@ object AndroidX {
const val TestEspresso = "androidx.test.espresso:espresso-core:${Version.TestEspresso}"
const val ActivityKtx = "androidx.activity:activity-ktx:${Version.ActivityKtx}"
const val FragmentKtx = "androidx.fragment:fragment-ktx:${Version.FragmentKtx}"
+ const val MultiDex = "androidx.multidex:multidex:${Version.MultiDex}"
}
object Android {
diff --git a/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/ProjectPluginManager.kt b/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/ProjectPluginManager.kt
index ed74a20..0746836 100644
--- a/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/ProjectPluginManager.kt
+++ b/buildSrc/src/main/java/com.quyunshuo.androidbaseframemvvm.build/ProjectPluginManager.kt
@@ -6,4 +6,5 @@ package com.quyunshuo.androidbaseframemvvm.build
object ProjectPluginManager {
const val AndroidToolsPlugin = "com.android.tools.build:gradle:4.0.1"
const val KotlinPlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0"
+ const val DaggerHiltPlugin = "com.google.dagger:hilt-android-gradle-plugin:2.28.1-alpha"
}
\ No newline at end of file
diff --git a/moduleBase.gradle b/moduleBase.gradle
new file mode 100644
index 0000000..840c365
--- /dev/null
+++ b/moduleBase.gradle
@@ -0,0 +1,82 @@
+import com.quyunshuo.androidbaseframemvvm.build.*
+
+if (BuildConfig.isAppMode) {
+ apply plugin: 'com.android.application'
+} else {
+ apply plugin: 'com.android.library'
+}
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-kapt'
+apply plugin: 'dagger.hilt.android.plugin'
+
+android {
+ compileSdkVersion BuildConfig.compileSdkVersion
+ buildToolsVersion BuildConfig.buildToolsVersion
+
+ defaultConfig {
+ minSdkVersion BuildConfig.minSdkVersion
+ targetSdkVersion BuildConfig.targetSdkVersion
+ versionCode BuildConfig.versionCode
+ versionName BuildConfig.versionName
+ testInstrumentationRunner AndroidX.AndroidJUnitRunner
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_1_8.toString()
+ }
+
+ buildFeatures {
+ viewBinding = true
+ }
+
+ //根据不同的模式加载不同的AndroidManifest文件
+ sourceSets {
+ main {
+ if (BuildConfig.isAppMode) {
+ manifest.srcFile 'src/main/java/debug/AndroidManifest.xml'
+ } else {
+ manifest.srcFile 'src/main/AndroidManifest.xml'
+ java {
+ //排除debug文件夹下的所有文件
+ exclude 'debug/**'
+ }
+ }
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ debug {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+kapt {
+ arguments {
+ arg("AROUTER_MODULE_NAME", project.getName())
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+
+ api project(path: ':Lib_Base')
+
+ testImplementation Android.Junit
+ androidTestImplementation AndroidX.TestExtJunit
+ androidTestImplementation AndroidX.TestEspresso
+ api JetPack.HiltDaggerAndroid
+ kapt JetPack.HiltDaggerCompiler
+ kapt JetPack.Hilt
+}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 68bdde9..9244785 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,4 @@
+include ':Lib_Main'
+include ':Lib_Base'
include ':app'
rootProject.name = "AndroidBaseFrameMVVM"
\ No newline at end of file