提交 a9b64acd authored 作者: vipcxj's avatar vipcxj

add: 热更新支持

上级 95015694
差异被折叠。
......@@ -94,6 +94,8 @@ def enableSeparateBuildPerCPUArchitecture = false
*/
def enableProguardInReleaseBuilds = false
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
......@@ -109,6 +111,23 @@ android {
abiFilters "armeabi-v7a", "x86"
}
}
productFlavors {
dev {
minSdkVersion 21
}
prod {
minSdkVersion 16
}
}
dexOptions {
javaMaxHeapSize "2G"
}
releaseStaging {
buildConfigField "String", "CODEPUSH_KEY", '"' + properties.getProperty("code_push.key_staging") + '"'
}
release {
buildConfigField "String", "CODEPUSH_KEY", '"' + properties.getProperty("code_push.key_production") + '"'
}
signingConfigs {
release {
storeFile file("app.jks")
......
D4OD3'd9
\ No newline at end of file
......@@ -34,7 +34,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CodePush(null, getApplicationContext(), BuildConfig.DEBUG),
new CodePush(BuildConfig.CODEPUSH_KEY, getApplicationContext(), BuildConfig.DEBUG),
new RNDeviceInfo(),
new IDCardReactPackage()
);
......
......@@ -18,4 +18,6 @@
# org.gradle.parallel=true
android.useDeprecatedNdk=true
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx3G
......@@ -9,3 +9,5 @@
# header note.
#Wed Sep 27 15:26:11 CST 2017
sdk.dir=/Users/yaohx_169/Library/Android/sdk
code_push.key_production=1jJDUki8dREADfZnMQWgjrk02K1Q4ksvOXqog
code_push.key_staging=09Bbn7Y3d8WBtouy9x5JxTjVvZgI4ksvOXqog
......@@ -2,6 +2,7 @@ import React, { PureComponent } from 'react';
import { BackHandler, Animated, Easing } from 'react-native';
import { StackNavigator, addNavigationHelpers, NavigationActions } from 'react-navigation';
import { connect } from 'react-redux';
import codePush from 'react-native-code-push';
import NavigatorService from './services/navigator';
import Welcome from './routes/welcome';
import Error from './routes/error';
......@@ -66,6 +67,11 @@ class Router extends PureComponent {
BackHandler.addEventListener('hardwareBackPress', this.backHandle);
}
componentDidMount() {
codePush.sync();
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.backHandle);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论