Skip to content

Commit 5bda24c

Browse files
committed
Merge remote-tracking branch 'origin/develop/1.0'
2 parents 4ced26a + ef9973c commit 5bda24c

File tree

34 files changed

+296
-162
lines changed

34 files changed

+296
-162
lines changed

app/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
minSdkVersion 16
1010
targetSdkVersion 27
1111
versionCode 1
12-
versionName "1.0"
12+
versionName "1.0.0"
1313
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1414
ndk {
1515
abiFilters 'armeabi', 'armeabi-v7a', 'x86'
@@ -25,6 +25,7 @@ android {
2525
repositories {
2626
flatDir {
2727
dirs 'libs'
28+
dirs project(':sdk').file('libs')
2829
}
2930
}
3031
useLibrary 'org.apache.http.legacy'
@@ -40,8 +41,6 @@ dependencies {
4041
compile "com.android.support:appcompat-v7:27.1.1"
4142
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
4243
//依赖library
43-
// debugCompile project(path: ':sdk', configuration: 'debug')
44-
//releaseCompile project(path: ':sdk', configuration: 'release')
4544
compile project(path: ':sdk')
4645
}
4746
repositories {

app/src/main/java/com/feelschaotic/sdkhotfix/MainActivity.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ class MainActivity : Activity() {
1919
fix_btn.setOnClickListener {
2020
initHotfix()
2121
}
22-
call_bug_method_btn.setOnClickListener { callBug() }
23-
rollback_btn.setOnClickListener { rollback() }
24-
}
25-
26-
private fun callBug() {
27-
}
28-
29-
private fun rollback() {
30-
3122
}
3223

3324
private fun initHotfix() {

app/src/main/res/layout/activity_main.xml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,5 @@
1717
app:layout_constraintRight_toRightOf="parent"
1818
app:layout_constraintTop_toTopOf="parent" />
1919

20-
<Button
21-
android:id="@+id/call_bug_method_btn"
22-
android:layout_width="wrap_content"
23-
android:layout_height="wrap_content"
24-
android:layout_marginTop="8dp"
25-
android:text="调用有bug的方法"
26-
app:layout_constraintHorizontal_bias="0.064"
27-
app:layout_constraintLeft_toLeftOf="parent"
28-
app:layout_constraintRight_toRightOf="parent"
29-
app:layout_constraintTop_toBottomOf="@+id/fix_btn" />
30-
31-
<Button
32-
android:id="@+id/rollback_btn"
33-
android:layout_width="wrap_content"
34-
android:layout_height="wrap_content"
35-
android:layout_marginTop="8dp"
36-
android:text="回滚补丁"
37-
app:layout_constraintHorizontal_bias="0.054"
38-
app:layout_constraintLeft_toLeftOf="parent"
39-
app:layout_constraintRight_toRightOf="parent"
40-
app:layout_constraintTop_toBottomOf="@+id/call_bug_method_btn" />
4120

4221
</android.support.constraint.ConstraintLayout>

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
jcenter()
99
google()
1010
maven { url 'https://maven.google.com' }
11+
maven { url "https://mvnrepository.com/" }
1112
}
1213
dependencies {
1314

@@ -20,9 +21,10 @@ buildscript {
2021

2122
allprojects {
2223
repositories {
23-
// TODO: maven { url "" }
2424
jcenter()
2525
maven { url 'https://maven.google.com' }
26+
maven { url 'https://jitpack.io' }
27+
maven { url "https://mvnrepository.com/" }
2628
}
2729
}
2830

buildSrc/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ apply plugin: 'maven'
44

55
repositories {
66
jcenter()
7-
maven { url "TODO" }
87
maven() { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
98
}
109

@@ -20,7 +19,6 @@ dependencies {
2019
compile files('libs/httpcore-4.4.1.jar')
2120
compile files('libs/jdom-1.1.jar')
2221
compile files('libs/encrypt-1.0.jar')
23-
2422
compile 'com.squareup.okhttp3:okhttp:3.14.0'
2523
compile 'com.alibaba:fastjson:1.2.46'
2624
}

business_sdk/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
*.iml
22
.gradle
33
/local.properties
4-
/.idea/*
54
/.idea/caches
65
/.idea/libraries
76
/.idea/modules.xml

business_sdk/app/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@ android {
2020
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2121
}
2222
}
23+
24+
lintOptions {
25+
abortOnError false
26+
}
27+
2328
}
2429

2530
dependencies {
31+
// implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
2632
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
2733
implementation 'com.android.support:appcompat-v7:27.1.1'
2834
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
@@ -36,11 +42,16 @@ dependencies {
3642
// implementation 'com.feelschaotic.samplesdk:1.0.0'
3743
//因为我把maven的配置删掉了,所以以本地aar的方式引入插桩的sdk(插桩意味着支持了热更新)
3844
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
45+
46+
//因为没有把samplesdk上传到maven,只是打个aar包放在lib下引用一下,所以需要导入SDKHotFix库(没有pom文件,下不了依赖)
47+
//如果你的业务sdk已经上传了maven,那就可以删掉这条导包了
48+
implementation 'com.github.feelschaotic:SDKHotFix:1.2-RELEASE'
3949
} else {
4050
// 默认用的是插桩的sdk1.0.0(有bug的sdk)
4151
// 不要再问为什么改了samplesdk module代码运行不生效了!因为这里压根就没有直接引用module
4252
// 为什么我不直接引用module(无插桩,不支持热更)?我怕有小伙伴拿着demo一跑就问我,为什么补丁没生效呀!?
4353
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
54+
implementation 'com.github.feelschaotic:SDKHotFix:1.2-RELEASE'
4455
}
4556

4657
}
17 KB
Binary file not shown.

business_sdk/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
android:label="@string/app_name"
88
android:roundIcon="@mipmap/ic_launcher_round"
99
android:supportsRtl="true"
10+
android:allowBackup="false"
1011
android:theme="@style/AppTheme"
11-
tools:replace="android:label,android:icon,android:theme">
12+
tools:replace="android:label,android:icon,android:theme,android:allowBackup">
1213
<activity android:name=".MainActivity">
1314
<intent-filter>
1415
<action android:name="android.intent.action.MAIN"/>

business_sdk/app/src/main/java/com/feelschaotic/business_sdk/MainActivity.kt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,34 @@ package com.feelschaotic.business_sdk
22

33
import android.os.Bundle
44
import android.support.v7.app.AppCompatActivity
5+
import android.util.Log
6+
import com.feelschaotic.samplesdk.SdkManager
7+
import kotlinx.android.synthetic.main.activity_main.*
58

69
class MainActivity : AppCompatActivity() {
710

811
override fun onCreate(savedInstanceState: Bundle?) {
912
super.onCreate(savedInstanceState)
1013
setContentView(R.layout.activity_main)
1114

12-
/* init_btn.setOnClickListener {
15+
init_btn.setOnClickListener {
1316
Log.d("TAG", "初始化业务sdk")
1417
SdkManager.init(application)
1518
}
1619

1720
fix_btn.setOnClickListener {
18-
Log.d("TAG", "初始化hotfix sdk(延迟初始化,避免一进来就初始化会把补丁给打上,看不到效果)")
21+
Log.d("TAG", "初始化hotfix sdk")
1922
SdkManager.fixBug()
2023
}
24+
2125
call_bug_btn.setOnClickListener {
2226
Log.d("TAG", "调用业务sdk有bug的方法")
2327
SdkManager.callBug()
24-
}*/
28+
}
29+
30+
call_bug_again_btn.setOnClickListener {
31+
Log.d("TAG", "调用业务sdk有bug的方法")
32+
SdkManager.callBug()
33+
}
2534
}
2635
}

0 commit comments

Comments
 (0)