forked from flutter-team-archive/plugins
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle
More file actions
115 lines (101 loc) · 4.01 KB
/
Copy pathbuild.gradle
File metadata and controls
115 lines (101 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
// Load the build signing secrets from a local `keystore.properties` file.
// TODO(YOU): Create release keys and a `keystore.properties` file. See
// `example/README.md` for more info and `keystore.example.properties` for an
// example.
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
def configured = true
try {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} catch (IOException e) {
configured = false
logger.error('Release signing information not found.')
}
project.ext {
// TODO(YOU): Create release keys and a `keystore.properties` file. See
// `example/README.md` for more info and `keystore.example.properties` for an
// example.
APP_ID = configured ? keystoreProperties['appId'] : "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE"
KEYSTORE_STORE_FILE = configured ? rootProject.file(keystoreProperties['storeFile']) : null
KEYSTORE_STORE_PASSWORD = keystoreProperties['storePassword']
KEYSTORE_KEY_ALIAS = keystoreProperties['keyAlias']
KEYSTORE_KEY_PASSWORD = keystoreProperties['keyPassword']
VERSION_CODE = configured ? keystoreProperties['versionCode'].toInteger() : 1
VERSION_NAME = configured ? keystoreProperties['versionName'] : "0.0.1"
}
if (project.APP_ID == "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE") {
configured = false
logger.error('Unique package name not set, defaulting to "io.flutter.plugins.inapppurchaseexample.DEFAULT_DO_NOT_USE".')
}
// Log a final error message if we're unable to create a release key signed
// build for an app configured in the Play Developer Console. Apks built in this
// condition won't be able to call any of the BillingClient APIs.
if (!configured) {
logger.error('The app could not be configured for release signing. In app purchases will not be testable. See `example/README.md` for more info and instructions.')
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
signingConfigs {
release {
storeFile project.KEYSTORE_STORE_FILE
storePassword project.KEYSTORE_STORE_PASSWORD
keyAlias project.KEYSTORE_KEY_ALIAS
keyPassword project.KEYSTORE_KEY_PASSWORD
}
}
compileSdkVersion 29
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId project.APP_ID
minSdkVersion 16
targetSdkVersion 28
versionCode project.VERSION_CODE
versionName project.VERSION_NAME
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
// Google Play Billing APIs only work with apps signed for production.
debug {
if (configured) {
signingConfig signingConfigs.release
} else {
signingConfig signingConfigs.debug
}
}
release {
if (configured) {
signingConfig signingConfigs.release
} else {
signingConfig signingConfigs.debug
}
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.android.billingclient:billing:3.0.2'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:3.6.0'
testImplementation 'org.json:json:20180813'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}