chore(android) fix native build

This commit is contained in:
Bartol Karuza 2019-03-03 15:43:30 +08:00
parent 5e7fa0edc8
commit d4a7ab7194
7 changed files with 81 additions and 26 deletions

View File

@ -18,7 +18,7 @@ aliases:
- &save-ios-build-cache
paths:
- ~/react-native-netinfo/example/ios/build/Build
- ~/react-native-cameraroll/example/ios/build/Build
key: v1-ios-build-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}
when: always

View File

@ -1,36 +1,42 @@
buildscript {
repositories {
jcenter()
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeCameraRoll_' + name]
}
def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeCameraRoll_' + name]).toInteger()
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
buildToolsVersion getExtOrDefault('buildToolsVersion')
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
}
}
repositories {
mavenCentral()
google()
jcenter()
mavenCentral()
}
dependencies {
compile 'com.facebook.react:react-native:+'
//noinspection GradleDynamicVersion
api 'com.facebook.react:react-native:+'
}

View File

@ -0,0 +1,4 @@
ReactNativeNetInfo_compileSdkVersion=28
ReactNativeNetInfo_buildToolsVersion=28.0.3
ReactNativeNetInfo_targetSdkVersion=27
ReactNativeNetInfo_minSdkVersion=16

View File

@ -73,7 +73,10 @@ import com.android.build.OutputFile
*/
project.ext.react = [
entryFile: "example/index.js"
entryFile: "example/index.js",
nodeExecutableAndArgs: ["echo", "'Skipping bundling"],
root: "../../../",
bundleInRelease: false
]
apply from: "../../../node_modules/react-native/react.gradle"
@ -98,11 +101,24 @@ android {
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.reactnativecommunity.cameraroll.camerarollexample"
applicationId "com.reactnativecommunity.cameraroll.example"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
if (project.hasProperty('EXAMPLE_APP_STORE_FILE')) {
storeFile file(EXAMPLE_APP_STORE_FILE)
storePassword EXAMPLE_APP_STORE_PASSWORD
keyAlias EXAMPLE_APP_KEY_ALIAS
keyPassword EXAMPLE_APP_KEY_PASSWORD
}
}
}
splits {
abi {
@ -114,6 +130,7 @@ android {
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
@ -135,9 +152,15 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(':react-native-cameraroll')
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-cameraroll')
androidTestImplementation(project(path: ":detox"))
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
}
// Run this once to be able to run the application with BUCK

View File

@ -3,10 +3,14 @@
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
minSdkVersion = 18
compileSdkVersion = 28
targetSdkVersion = 27
targetSdkVersion = 28
supportLibVersion = "28.0.0"
// e2e
kotlinVersion = '1.3.21'
detoxKotlinVersion = '1.3.21'
}
repositories {
google()
@ -14,6 +18,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@ -49,3 +54,7 @@ task wrapper(type: Wrapper) {
gradleVersion = '4.7'
distributionUrl = distributionUrl.replace("bin", "all")
}
subprojects {
task listAllDependencies(type: DependencyReportTask) {}
}

View File

@ -16,3 +16,12 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=true
EXAMPLE_APP_STORE_FILE=release.keystore
EXAMPLE_APP_KEY_ALIAS=androiddebugkey
EXAMPLE_APP_STORE_PASSWORD=android
EXAMPLE_APP_KEY_PASSWORD=android

View File

@ -5,4 +5,8 @@ project(':react-native-cameraroll').projectDir = new File(rootProject.projectDir
// For your application the line above will most likely be:
// project(':react-native-cameraroll').projectDir = new File(rootProject.projectDir, '../node_modules/!react-native-community/cameraroll/android')
// e2e tests
include ':detox'
project(':detox').projectDir = new File(rootProject.projectDir, '../../node_modules/detox/android/detox')
include ':app'