From ca46e9d6283183a129636d08a2cb73d46717c348 Mon Sep 17 00:00:00 2001
From: zhouyufeng <1131806677@qq.com>
Date: Fri, 16 Apr 2021 15:25:35 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0lib?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/gradle.xml | 1 +
baselibrary/.gitignore | 1 +
baselibrary/build.gradle | 44 +++++++++++++++++++
baselibrary/consumer-rules.pro | 0
baselibrary/proguard-rules.pro | 21 +++++++++
.../baselibrary/ExampleInstrumentedTest.kt | 24 ++++++++++
baselibrary/src/main/AndroidManifest.xml | 5 +++
.../java/com/sjc/baselibrary/MyUtils.java | 10 +++++
.../com/sjc/baselibrary/ExampleUnitTest.kt | 17 +++++++
settings.gradle | 1 +
10 files changed, 124 insertions(+)
create mode 100644 baselibrary/.gitignore
create mode 100644 baselibrary/build.gradle
create mode 100644 baselibrary/consumer-rules.pro
create mode 100644 baselibrary/proguard-rules.pro
create mode 100644 baselibrary/src/androidTest/java/com/sjc/baselibrary/ExampleInstrumentedTest.kt
create mode 100644 baselibrary/src/main/AndroidManifest.xml
create mode 100644 baselibrary/src/main/java/com/sjc/baselibrary/MyUtils.java
create mode 100644 baselibrary/src/test/java/com/sjc/baselibrary/ExampleUnitTest.kt
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 6d6034b..f4de0ba 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -11,6 +11,7 @@
+
diff --git a/baselibrary/.gitignore b/baselibrary/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/baselibrary/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/baselibrary/build.gradle b/baselibrary/build.gradle
new file mode 100644
index 0000000..ab64620
--- /dev/null
+++ b/baselibrary/build.gradle
@@ -0,0 +1,44 @@
+plugins {
+ id 'com.android.library'
+ id 'kotlin-android'
+}
+
+android {
+ compileSdkVersion 30
+ buildToolsVersion "30.0.3"
+
+ defaultConfig {
+ minSdkVersion 16
+ targetSdkVersion 30
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles "consumer-rules.pro"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+}
+
+dependencies {
+
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ implementation 'androidx.core:core-ktx:1.2.0'
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'com.google.android.material:material:1.1.0'
+ testImplementation 'junit:junit:4.+'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+}
\ No newline at end of file
diff --git a/baselibrary/consumer-rules.pro b/baselibrary/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
diff --git a/baselibrary/proguard-rules.pro b/baselibrary/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/baselibrary/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/baselibrary/src/androidTest/java/com/sjc/baselibrary/ExampleInstrumentedTest.kt b/baselibrary/src/androidTest/java/com/sjc/baselibrary/ExampleInstrumentedTest.kt
new file mode 100644
index 0000000..95bb193
--- /dev/null
+++ b/baselibrary/src/androidTest/java/com/sjc/baselibrary/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.sjc.baselibrary
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("com.sjc.baselibrary.test", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/baselibrary/src/main/AndroidManifest.xml b/baselibrary/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ac4f90d
--- /dev/null
+++ b/baselibrary/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/baselibrary/src/main/java/com/sjc/baselibrary/MyUtils.java b/baselibrary/src/main/java/com/sjc/baselibrary/MyUtils.java
new file mode 100644
index 0000000..662a68e
--- /dev/null
+++ b/baselibrary/src/main/java/com/sjc/baselibrary/MyUtils.java
@@ -0,0 +1,10 @@
+package com.sjc.baselibrary;
+
+import android.widget.TextView;
+
+public class MyUtils {
+
+ public void setText(TextView view ,String s ){
+ view.setText(s);
+ }
+}
diff --git a/baselibrary/src/test/java/com/sjc/baselibrary/ExampleUnitTest.kt b/baselibrary/src/test/java/com/sjc/baselibrary/ExampleUnitTest.kt
new file mode 100644
index 0000000..d24b0b7
--- /dev/null
+++ b/baselibrary/src/test/java/com/sjc/baselibrary/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.sjc.baselibrary
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index c08c20b..20cdacb 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,3 @@
+include ':baselibrary'
include ':app'
rootProject.name = "testAndroid"
\ No newline at end of file