Skip to content

Commit 9ec19f2

Browse files
committed
修改
1 parent a2d974a commit 9ec19f2

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

_posts/2018-09-06-正式测试地址打包自动切换.markdown

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#android studio的debug和release模式下使用不同的Http前缀进行测试与正式环境的自动切换
1+
# android studio的debug和release模式下使用不同的Http前缀进行测试与正式环境的自动切换
22

33

4-
我写代码的时候一般会使用两个环境,一个是测试环境,一个是正式环境并且这个两个环境的http请求连接地址的前缀肯定是不一样的
4+
在项目开发过程中一般会使用两种Url环境,一个是测试环境,一个是正式环境并且这个两个环境的http请求连接地址的前缀肯定是不一样的
55

66
例如,测试环境我们使用http://192.168.1.1:8080作为请求前缀
77

@@ -11,13 +11,13 @@
1111

1212
安卓的机制中有一个变量用来区分正式和测试环境,我们可以拿到这个变量然后对他进行判断就可以自动去根据模式来改变url地址前缀
1313

14-
##使用变量BuildConfig.DEBUG(debug模式返回true,release模式返回false)
14+
## 使用变量BuildConfig.DEBUG(debug模式返回true,release模式返回false)
1515

1616
位置:app->build->generated->source->buildCofig->debug->BuildConfig文件,如图:
1717

18-
在用的时候我们会定义一个全局的HttpUrl.myurl
18+
#### 在用的时候我们会定义一个全局的Url地址。
1919

20-
###我们写一个三木运算就可以得到想要的分环境的不同url
20+
### 我们写一个三木运算就可以得到想要的分环境的不同url
2121
### BuildConfig.DEBUG? 测试地址: 正式地址
2222

2323
这样使用release打包出来的应用就是会使用正式的url前缀,测试的时候run app默认是使用就是debug,所以就解决了使用地址错的的问题了

about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: page
33
title: "About"
4-
description: "Hey, this is Hux."
4+
description: "Hey, this is Tyxs."
55
header-img: "img/about-bg-walle.jpg"
66
multilingual: true
77
---

cfastdeva.github.io.iml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="WEB_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$" />
6+
<orderEntry type="inheritedJdk" />
7+
<orderEntry type="sourceFolder" forTests="false" />
8+
</component>
9+
</module>

0 commit comments

Comments
 (0)