Commit 82c291be by chengfengpiaopiao

增加打包配置

parent 71375129
......@@ -55,7 +55,7 @@
</profile-state>
</entry>
</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" />
</component>
<component name="ProjectType">
......
......@@ -2,11 +2,8 @@
<project version="4">
<component name="ProjectModuleManager">
<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://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://G:/Product/Android/DuoBaoJingCai/app/app.iml" filepath="G:/Product/Android/DuoBaoJingCai/app/app.iml" />
</modules>
</component>
</project>
\ No newline at end of file
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 {
compileSdkVersion 25
buildToolsVersion "25.0.0"
......@@ -9,12 +20,12 @@ android {
targetSdkVersion 25
versionCode 1
versionName "1.0"
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "test"] //默认名称
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "base"] //默认名称
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //方法数超过65535
}
//配置keystore签名
signingConfigs {
release {
......@@ -25,27 +36,45 @@ android {
}
}
// productFlavors {
// wandoujia {}
// baidu {}
// c360 {}
// uc {}
// xiaomi {}
// huawei {}
// productFlavors.all { flavor ->
// flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
// }
// }
//多渠道配置
productFlavors {
wandoujia {}
baidu {}
c360 {}
uc {}
xiaomi {}
huawei {}
productFlavors.all { flavor ->
flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
}
}
buildTypes {
release {
minifyEnabled false
minifyEnabled false //是否混淆
zipAlignEnabled true //Zipalign优化
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "int", "network_type", networkType
buildConfigField "boolean", "ENABLE_DEBUG", "false"
}
debug {
minifyEnabled false
//shrinkResources true 有了minifyEnabled就不要这个,混淆的时候会过滤无用处资源
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)
}
}
}
......
#
#
#这个文件用于打包的时候,自定义一些数据
# networkType
# 0: 测试地址
# 1: //外部测试地址
# 2: //正式地址
networkType = 2
\ No newline at end of file
......@@ -21,19 +21,23 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--58c25576c895767d61000ec7 -->
<meta-data
android:name="UMENG_APPKEY"
android:value="5a0abb218f4a9d05b0000036" />
<!--<meta-data-->
<!--android:name="UMENG_MESSAGE_SECRET"-->
<!--android:value="771f0753ec80810bfced1e7347520fe7"/>-->
<!--&lt;!&ndash;<meta-data&ndash;&gt;-->
<!--&lt;!&ndash;android:name="UMENG_MESSAGE_SECRET"&ndash;&gt;-->
<!--&lt;!&ndash;android:value="771f0753ec80810bfced1e7347520fe7"/>&ndash;&gt;-->
<meta-data
android:name="UMENG_CHANNEL"
android:value="${UMENG_CHANNEL_VALUE}" />
<meta-data
android:name="TD_CHANNEL_ID"
android:value="maile" />
<!--<meta-data-->
<!--android:name="TD_CHANNEL_ID"-->
<!--android:value="maile" />-->
<activity
android:launchMode="singleTop"
......
......@@ -25,7 +25,23 @@ public class BaseApplication extends Application{
super.onCreate();
DrawUtil.resetDensity(this);
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"));
}
//初始化微信SDK
......@@ -45,7 +61,7 @@ public class BaseApplication extends Application{
return appInfo.metaData.getString(key);
} catch (PackageManager.NameNotFoundException ignored) {
}
return "错误";
return "base2";
}
public static Context getAppContext() {
......
package com.maile.jingcai.base;
import com.maile.jingcai.BuildConfig;
/**
* Created by chengfeng-piaopiao on 2017/11/9.
*/
public class Constant {
interface networkType{
int TEST = 0; //测试地址
int OUT_TEST = 1; //外部测试地址
int RELEASE = 2; //正式地址
}
public static final boolean DEBUG = true;
public static final String BASE_URL = "http://192.168.1.250:81";
......@@ -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_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;
}
}
}
......@@ -25,7 +25,7 @@ public class RspCheckInterceptor implements Interceptor {
try {
ResponseBody rspBody = response.body();
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
if (status != 0 && status != 200){ //请求失败
String msg = jsonObject.getString("msg");
......
......@@ -140,7 +140,7 @@ public class LoginActivity extends Activity implements ILoginView {
Context.MODE_PRIVATE);
String token = preferencesManager.getString(IPreferencesIds.TOKEN, "");
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天过期时间
if (!token.equals("")) {
//调用自动登录接口
......
......@@ -297,7 +297,6 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
@Override
public void onError(Throwable errorException) {
LoginActivity.startEntranceActivity(mContext);
mLoading.setVisibility(View.GONE);
Log.d("tangwen", "onError: " + errorException.getMessage());
if (errorException == null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment