Skip to content

Commit

Permalink
add basic signature in template (#22665)
Browse files Browse the repository at this point in the history
Summary:
react-native-community/cli#38.
add basic signature in template.
Signature file is the same as RNTester.
pass all current ci.
 [Android] [Feature] - add basic signature in template
Pull Request resolved: #22665

Differential Revision: D13490480

Pulled By: hramos

fbshipit-source-id: 9d0ca4debde2ddbde0d4a611b9b41fc24235314a
  • Loading branch information
gengjiawen authored and facebook-github-bot committed Dec 17, 2018
1 parent 871b763 commit 63ebbd6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
14 changes: 14 additions & 0 deletions template/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,22 @@ android {
include "armeabi-v7a", "x86", "arm64-v8a"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug

This comment has been minimized.

Copy link
@alexander-w-o-s

alexander-w-o-s Aug 14, 2019

Hi @gengjiawen,
Does it makes sense to remove line # 130 with signingConfigs.debug usage in release buildTypes?
This line makes impossible to use Microsoft App Center Build service for React Native Android without removing that line.

See this issue - microsoft/appcenter#878

React Native documentation already says about adding "signingConfig" in release buildTypes when developers prepare signed release builds.

Do you see a reason to keep this line in React Native template?

This comment has been minimized.

Copy link
@gengjiawen

gengjiawen Aug 14, 2019

Author Contributor

We need it to test template release. You can replace this in your own code. I have not been using appcenter, not knowing why it fail.

This comment has been minimized.

Copy link
@alexander-w-o-s

alexander-w-o-s Aug 14, 2019

Sorry, that I'm boring you with questions.
I know that I can change /android/app/build.gradle
But I think many react-native developers may find it as a new change that they did not do before (if they sign apk outside of gradle).
Below you can find my thoughts why I suggest to remove that line.

You said:

We need it to test template release.

Can you please be more specific how you make that test?
Can you please send a link to the source code that depends on this change?
I think this information will be useful to better understand why it is important to use debug signing config in release build type.

Perhaps someone will find a solution that both solves these needs for test template release and avoids additional steps for using manual signing.

Why I suggest to remove that line

App Center Build fails because it uses manual app signing after gradle.
And they cannot complete manual signing (using jarsigner) because apk files already signed by gradle.
It worked perfect before this change in /android/app/build.gradle

And I think it may break similar CI/CD configurations, where apk files signed using different tools rather then using gradle.

Android documentation says that it is ok to manually sign:

However, you can also manually sign your app for upload to Google Play and other app stores.

https://developer.android.com/studio/publish/app-signing

And here is a quote from Microsoft App Center Build Configuration:

Since trying to sign a build twice is not supported, make sure that if you provide the signing credentials manually, you have no conflicts with signing configurations in your Gradle configuration for the chosen build variant.

https://docs.microsoft.com/en-us/appcenter/build/android/code-signing

This comment has been minimized.

Copy link
@gengjiawen

gengjiawen Aug 14, 2019

Author Contributor

Can you please be more specific how you make that test?

We need it the proguard rules works for release build. You can't do it with no signingConfig.

And I think it may break similar CI/CD configurations, where apk files signed using different tools rather then using gradle.

It's the official way to sign the app.

Will additional env works (like gradle flag) for you case ?

This comment has been minimized.

Copy link
@Ashoat

Ashoat Sep 18, 2019

Contributor

@gengjiawen, thanks for all the work you do to support the React Native ecosystem, and especially the Android side.

I'm working on upgrading from 0.59 to 0.60 and noticed this change. I have a small question.

Before this change, when building debug Gradle would automatically create ~/.android/debug.keystore for me and use that. With this change, you've set up the template to use an existing keystore file for debug.

It makes sense to me that release needs a signingConfig. But why does debug need it?

Could debug.keystore be renamed release.keystore, and could lines 124-126 be removed?

minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
Expand Down
Binary file added template/android/app/debug.keystore
Binary file not shown.
8 changes: 0 additions & 8 deletions template/android/keystores/_BUCK

This file was deleted.

4 changes: 0 additions & 4 deletions template/android/keystores/debug.keystore.properties

This file was deleted.

0 comments on commit 63ebbd6

Please sign in to comment.