Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
唐文
/
AiyoZhuaWaWa
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
82c291be
authored
Nov 15, 2017
by
chengfengpiaopiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加打包配置
parent
71375129
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
115 additions
and
30 deletions
.idea/misc.xml
.idea/modules.xml
app/build.gradle
app/buildcustom.properties
app/src/main/AndroidManifest.xml
app/src/main/java/com/maile/jingcai/base/BaseApplication.java
app/src/main/java/com/maile/jingcai/base/Constant.java
app/src/main/java/com/maile/jingcai/module/net/interceptor/RspCheckInterceptor.java
app/src/main/java/com/maile/jingcai/view/activity/LoginActivity.java
app/src/main/java/com/maile/jingcai/wxapi/WXEntryActivity.java
.idea/misc.xml
View file @
82c291be
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
</profile-state>
</profile-state>
</entry>
</entry>
</component>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
8
"
default=
"true"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
7
"
default=
"true"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
</component>
<component
name=
"ProjectType"
>
<component
name=
"ProjectType"
>
...
...
.idea/modules.xml
View file @
82c291be
...
@@ -2,11 +2,8 @@
...
@@ -2,11 +2,8 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectModuleManager"
>
<component
name=
"ProjectModuleManager"
>
<modules>
<modules>
<module
fileurl=
"file://$PROJECT_DIR$/DuoBaoJingCai.iml"
filepath=
"$PROJECT_DIR$/DuoBaoJingCai.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/DuoBaoJingCai2.iml"
filepath=
"$PROJECT_DIR$/DuoBaoJingCai2.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/DuoBaoJingCai2.iml"
filepath=
"$PROJECT_DIR$/DuoBaoJingCai2.iml"
/>
<module
fileurl=
"file://G:/Product/Android/DuoBaoJingCai/DuoBaoJingCai2.iml"
filepath=
"G:/Product/Android/DuoBaoJingCai/DuoBaoJingCai2.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/app/app.iml"
filepath=
"$PROJECT_DIR$/app/app.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/app/app.iml"
filepath=
"$PROJECT_DIR$/app/app.iml"
/>
<module
fileurl=
"file://G:/Product/Android/DuoBaoJingCai/app/app.iml"
filepath=
"G:/Product/Android/DuoBaoJingCai/app/app.iml"
/>
</modules>
</modules>
</component>
</component>
</project>
</project>
\ No newline at end of file
app/build.gradle
View file @
82c291be
apply
plugin:
'com.android.application'
apply
plugin:
'com.android.application'
def
customPropsFile
=
file
(
"buildcustom.properties"
);
Properties
customProps
=
new
Properties
()
def
networkType
=
'2'
;
def
suffixName
=
[
'2'
:
''
,
'0'
:
'_test'
,
'1'
:
'_out_test'
]
if
(
customPropsFile
.
canRead
())
{
customProps
.
load
(
new
FileInputStream
(
customPropsFile
))
networkType
=
customProps
[
'networkType'
].
toString
()
}
println
(
"suffixName: "
+
suffixName
[
networkType
])
android
{
android
{
compileSdkVersion
25
compileSdkVersion
25
buildToolsVersion
"25.0.0"
buildToolsVersion
"25.0.0"
...
@@ -9,12 +20,12 @@ android {
...
@@ -9,12 +20,12 @@ android {
targetSdkVersion
25
targetSdkVersion
25
versionCode
1
versionCode
1
versionName
"1.0"
versionName
"1.0"
manifestPlaceholders
=
[
UMENG_CHANNEL_VALUE:
"
test
"
]
//默认名称
manifestPlaceholders
=
[
UMENG_CHANNEL_VALUE:
"
base
"
]
//默认名称
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled
true
//方法数超过65535
}
}
//配置keystore签名
//配置keystore签名
signingConfigs
{
signingConfigs
{
release
{
release
{
...
@@ -25,27 +36,45 @@ android {
...
@@ -25,27 +36,45 @@ android {
}
}
}
}
// productFlavors {
//多渠道配置
// wandoujia {}
// baidu {}
productFlavors
{
// c360 {}
wandoujia
{}
// uc {}
baidu
{}
// xiaomi {}
c360
{}
// huawei {}
uc
{}
// productFlavors.all { flavor ->
xiaomi
{}
// flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
huawei
{}
// }
productFlavors
.
all
{
flavor
->
// }
flavor
.
manifestPlaceholders
=
[
UMENG_CHANNEL_VALUE:
name
]
}
}
buildTypes
{
buildTypes
{
release
{
release
{
minifyEnabled
false
minifyEnabled
false
//是否混淆
zipAlignEnabled
true
//Zipalign优化
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
signingConfig
signingConfigs
.
release
signingConfig
signingConfigs
.
release
buildConfigField
"int"
,
"network_type"
,
networkType
buildConfigField
"boolean"
,
"ENABLE_DEBUG"
,
"false"
}
}
debug
{
debug
{
minifyEnabled
false
//shrinkResources true 有了minifyEnabled就不要这个,混淆的时候会过滤无用处资源
signingConfig
signingConfigs
.
release
signingConfig
signingConfigs
.
release
buildConfigField
"int"
,
"network_type"
,
networkType
buildConfigField
"boolean"
,
"ENABLE_DEBUG"
,
"true"
}
}
android
.
applicationVariants
.
all
{
variant
->
variant
.
outputs
.
each
{
output
->
def
outputFile
=
output
.
outputFile
def
channelName
=
variant
.
productFlavors
[
0
].
name
;
//这里修改文件名
def
fileName
=
"duobaojingcai_${channelName}_v${defaultConfig.versionName}${suffixName[networkType]}.apk"
output
.
outputFile
=
new
File
(
outputFile
.
parent
,
fileName
)
}
}
}
}
}
}
...
...
app/buildcustom.properties
0 → 100644
View file @
82c291be
#
#
#这个文件用于打包的时候,自定义一些数据
# networkType
# 0: 测试地址
# 1: //外部测试地址
# 2: //正式地址
networkType
=
2
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
82c291be
...
@@ -21,19 +21,23 @@
...
@@ -21,19 +21,23 @@
android:label=
"@string/app_name"
android:label=
"@string/app_name"
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
android:theme=
"@style/AppTheme"
>
<!--58c25576c895767d61000ec7 -->
<!--58c25576c895767d61000ec7 -->
<meta-data
<meta-data
android:name=
"UMENG_APPKEY"
android:name=
"UMENG_APPKEY"
android:value=
"5a0abb218f4a9d05b0000036"
/>
android:value=
"5a0abb218f4a9d05b0000036"
/>
<!--<meta-data-->
<!--android:name="UMENG_MESSAGE_SECRET"-->
<!--<!–<meta-data–>-->
<!--android:value="771f0753ec80810bfced1e7347520fe7"/>-->
<!--<!–android:name="UMENG_MESSAGE_SECRET"–>-->
<!--<!–android:value="771f0753ec80810bfced1e7347520fe7"/>–>-->
<meta-data
<meta-data
android:name=
"UMENG_CHANNEL"
android:name=
"UMENG_CHANNEL"
android:value=
"${UMENG_CHANNEL_VALUE}"
/>
android:value=
"${UMENG_CHANNEL_VALUE}"
/>
<
meta-data
<
!--<meta-data-->
android:name=
"TD_CHANNEL_ID"
<!--android:name="TD_CHANNEL_ID"-->
android:value=
"maile"
/
>
<!--android:value="maile" />--
>
<activity
<activity
android:launchMode=
"singleTop"
android:launchMode=
"singleTop"
...
...
app/src/main/java/com/maile/jingcai/base/BaseApplication.java
View file @
82c291be
...
@@ -25,7 +25,23 @@ public class BaseApplication extends Application{
...
@@ -25,7 +25,23 @@ public class BaseApplication extends Application{
super
.
onCreate
();
super
.
onCreate
();
DrawUtil
.
resetDensity
(
this
);
DrawUtil
.
resetDensity
(
this
);
regToWx
();
regToWx
();
// 场景类型设置接口,设置为普通统计场景类型
// MobclickAgent.setScenarioType(this, MobclickAgent.EScenarioType.E_UM_NORMAL);
// MobclickAgent.startWithConfigure(new MobclickAgent.UMAnalyticsConfig(getApplicationContext(),"5a0abb218f4a9d05b0000036",getChannel(getApplicationContext(),"UMENG_CHANNEL")));
// String appkey = "";
// String channal = "";
// try {
// appkey = PackageManagerUitls.getMateDataValue(this, "UMENG_APPKEY");
// channal = PackageManagerUitls.getMateDataValue(this, "UMENG_CHANNEL");
// } catch (PackageManager.NameNotFoundException e) {
// e.printStackTrace();
// }
// MobclickAgent.UMAnalyticsConfig config = new MobclickAgent.UMAnalyticsConfig(this, appkey, channal);
//
Log
.
i
(
"tangwen"
,
"Application: 获取渠道包信息 "
+
getChannel
(
getApplicationContext
(),
"UMENG_CHANNEL"
));
Log
.
i
(
"tangwen"
,
"Application: 获取渠道包信息 "
+
getChannel
(
getApplicationContext
(),
"UMENG_CHANNEL"
));
}
}
//初始化微信SDK
//初始化微信SDK
...
@@ -45,7 +61,7 @@ public class BaseApplication extends Application{
...
@@ -45,7 +61,7 @@ public class BaseApplication extends Application{
return
appInfo
.
metaData
.
getString
(
key
);
return
appInfo
.
metaData
.
getString
(
key
);
}
catch
(
PackageManager
.
NameNotFoundException
ignored
)
{
}
catch
(
PackageManager
.
NameNotFoundException
ignored
)
{
}
}
return
"
错误
"
;
return
"
base2
"
;
}
}
public
static
Context
getAppContext
()
{
public
static
Context
getAppContext
()
{
...
...
app/src/main/java/com/maile/jingcai/base/Constant.java
View file @
82c291be
package
com
.
maile
.
jingcai
.
base
;
package
com
.
maile
.
jingcai
.
base
;
import
com.maile.jingcai.BuildConfig
;
/**
/**
* Created by chengfeng-piaopiao on 2017/11/9.
* Created by chengfeng-piaopiao on 2017/11/9.
*/
*/
public
class
Constant
{
public
class
Constant
{
interface
networkType
{
int
TEST
=
0
;
//测试地址
int
OUT_TEST
=
1
;
//外部测试地址
int
RELEASE
=
2
;
//正式地址
}
public
static
final
boolean
DEBUG
=
true
;
public
static
final
boolean
DEBUG
=
true
;
public
static
final
String
BASE_URL
=
"http://192.168.1.250:81"
;
public
static
final
String
BASE_URL
=
"http://192.168.1.250:81"
;
...
@@ -15,4 +23,28 @@ public class Constant {
...
@@ -15,4 +23,28 @@ public class Constant {
public
static
final
String
WEIXIN_AUTH_LOGIN_INFO_SCOPE
=
"snsapi_userinfo"
;
public
static
final
String
WEIXIN_AUTH_LOGIN_INFO_SCOPE
=
"snsapi_userinfo"
;
public
static
final
String
WEIXIN_AUTH_LOGIN_INFO_STATE
=
"wtf"
;
public
static
final
String
WEIXIN_AUTH_LOGIN_INFO_STATE
=
"wtf"
;
//正式地址
public
static
final
String
RELEASE_BASE_URL
=
"http://700sport.com/"
;
//外部测试地址
public
static
final
String
OUT_BASE_URL_TEST
=
"http://106.75.137.139/"
;
// 测服的外网
//测试地址
public
static
final
String
BASE_URL_TEST
=
"http://192.168.175.136:8080/"
;
public
static
String
getBaseUrl
()
{
switch
(
BuildConfig
.
network_type
){
case
networkType
.
TEST
:
return
BASE_URL_TEST
;
case
networkType
.
OUT_TEST
:
return
OUT_BASE_URL_TEST
;
case
networkType
.
RELEASE
:
default
:
return
RELEASE_BASE_URL
;
}
}
}
}
app/src/main/java/com/maile/jingcai/module/net/interceptor/RspCheckInterceptor.java
View file @
82c291be
...
@@ -25,7 +25,7 @@ public class RspCheckInterceptor implements Interceptor {
...
@@ -25,7 +25,7 @@ public class RspCheckInterceptor implements Interceptor {
try
{
try
{
ResponseBody
rspBody
=
response
.
body
();
ResponseBody
rspBody
=
response
.
body
();
JSONObject
jsonObject
=
new
JSONObject
(
InterceptorUtils
.
getRspData
(
rspBody
));
JSONObject
jsonObject
=
new
JSONObject
(
InterceptorUtils
.
getRspData
(
rspBody
));
Log
.
d
(
"tangwen"
,
Constant
.
BASE_URL
+
"[/]: "
+
jsonObject
.
toString
());
Log
.
i
(
"tangwen"
,
Constant
.
BASE_URL
+
"[/]: "
+
jsonObject
.
toString
());
int
status
=
jsonObject
.
getInt
(
"code"
);
//status
int
status
=
jsonObject
.
getInt
(
"code"
);
//status
if
(
status
!=
0
&&
status
!=
200
){
//请求失败
if
(
status
!=
0
&&
status
!=
200
){
//请求失败
String
msg
=
jsonObject
.
getString
(
"msg"
);
String
msg
=
jsonObject
.
getString
(
"msg"
);
...
...
app/src/main/java/com/maile/jingcai/view/activity/LoginActivity.java
View file @
82c291be
...
@@ -140,7 +140,7 @@ public class LoginActivity extends Activity implements ILoginView {
...
@@ -140,7 +140,7 @@ public class LoginActivity extends Activity implements ILoginView {
Context
.
MODE_PRIVATE
);
Context
.
MODE_PRIVATE
);
String
token
=
preferencesManager
.
getString
(
IPreferencesIds
.
TOKEN
,
""
);
String
token
=
preferencesManager
.
getString
(
IPreferencesIds
.
TOKEN
,
""
);
String
openid_phone
=
preferencesManager
.
getString
(
IPreferencesIds
.
openid_phone
,
""
);
String
openid_phone
=
preferencesManager
.
getString
(
IPreferencesIds
.
openid_phone
,
""
);
Log
.
d
(
"tangwen"
,
"checkUserIsLogin: token = "
+
token
+
" openid_phone = "
+
openid_phone
);
Log
.
i
(
"tangwen"
,
"checkUserIsLogin: token = "
+
token
+
" openid_phone = "
+
openid_phone
);
//7天过期时间
//7天过期时间
if
(!
token
.
equals
(
""
))
{
if
(!
token
.
equals
(
""
))
{
//调用自动登录接口
//调用自动登录接口
...
...
app/src/main/java/com/maile/jingcai/wxapi/WXEntryActivity.java
View file @
82c291be
...
@@ -297,7 +297,6 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
...
@@ -297,7 +297,6 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
@Override
@Override
public
void
onError
(
Throwable
errorException
)
{
public
void
onError
(
Throwable
errorException
)
{
LoginActivity
.
startEntranceActivity
(
mContext
);
mLoading
.
setVisibility
(
View
.
GONE
);
mLoading
.
setVisibility
(
View
.
GONE
);
Log
.
d
(
"tangwen"
,
"onError: "
+
errorException
.
getMessage
());
Log
.
d
(
"tangwen"
,
"onError: "
+
errorException
.
getMessage
());
if
(
errorException
==
null
)
{
if
(
errorException
==
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment