Skip to content

Commit 16dbe7d

Browse files
committed
build apk for android
1 parent 1adf079 commit 16dbe7d

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

App.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export default class App extends Component<Props> {
1818
};
1919
onChangeText = text => {
2020
const suggestions = getSuggestions(text.trim().toLowerCase());
21-
console.log("suggestions", suggestions);
22-
2321
this.setState({
2422
suggestions: suggestions
2523
});

android/app/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ android {
108108
versionCode 1
109109
versionName "1.0"
110110
}
111+
signingConfigs {
112+
release {
113+
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
114+
storeFile file(MYAPP_RELEASE_STORE_FILE)
115+
storePassword MYAPP_RELEASE_STORE_PASSWORD
116+
keyAlias MYAPP_RELEASE_KEY_ALIAS
117+
keyPassword MYAPP_RELEASE_KEY_PASSWORD
118+
}
119+
}
120+
}
111121
splits {
112122
abi {
113123
reset()
@@ -120,6 +130,7 @@ android {
120130
release {
121131
minifyEnabled enableProguardInReleaseBuilds
122132
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
133+
signingConfig signingConfigs.release
123134
}
124135
}
125136
// applicationVariants are e.g. debug, release

android/gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19+
20+
MYAPP_RELEASE_STORE_FILE=dyw-release-key.keystore
21+
MYAPP_RELEASE_KEY_ALIAS=dyw-key-alias
22+
MYAPP_RELEASE_STORE_PASSWORD=6271218
23+
MYAPP_RELEASE_KEY_PASSWORD=6271218
24+

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"start": "node node_modules/react-native/local-cli/cli.js start",
77
"test": "jest",
88
"run-android": "react-native run-android",
9-
"run-ios": "react-native run-ios"
9+
"run-ios": "react-native run-ios",
10+
"build-android-apk": "cd android && ./gradlew assembleRelease && cd ../",
11+
"run-android-release": "react-native run-android --variant=release",
12+
"release-android": "yarn build-android-apk && yarn run-android-release"
1013
},
1114
"dependencies": {
1215
"react": "16.8.3",

0 commit comments

Comments
 (0)