Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
fix android builds
Browse files Browse the repository at this point in the history
  • Loading branch information
birkir committed Mar 8, 2019
1 parent c42559c commit b84b393
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 213 deletions.
195 changes: 77 additions & 118 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apply plugin: "com.android.application"

exec {
commandLine './scripts/build-env.sh'
workingDir '../../'
commandLine './scripts/build-env.sh'
workingDir '../../'
}

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
Expand Down Expand Up @@ -39,145 +39,104 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 28

defaultConfig {
applicationId "com.ueno.reactnativestarter"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled true
missingDimensionStrategy "minReactNative", "minReactNative46"
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57_5"
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
compileSdkVersion 28

defaultConfig {
applicationId "com.ueno.reactnativestarter"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled true
missingDimensionStrategy "minReactNative", "minReactNative46"
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57_5"
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
storeFile file("keystore.jks")
storePassword "12345678"
keyAlias "key0"
keyPassword "12345678"
}
release {
storeFile file("keystore.jks")
storePassword "12345678"
keyAlias "key0"
keyPassword "12345678"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
matchingFallbacks = ['release']
}
debug {
matchingFallbacks = ['debug']
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
matchingFallbacks = ['release']
}
debug {
matchingFallbacks = ['debug']
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}

packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
exclude 'META-INF/-no-jdk.kotlin_module'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/proguard/androidx-annotations.pro'
exclude 'META-INF/-no-jdk.kotlin_module'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}

dependencies {
implementation "com.facebook.react:react-native:+"
implementation fileTree(dir: "libs", include: ["*.jar"])

implementation project(':react-native-version-number')
implementation project(':react-native-sentry')
implementation project(':react-native-navigation')
implementation project(':react-native-code-push')
implementation project(':react-native-config')
implementation(project(':react-native-firebase')) {
transitive = false
}

implementation 'com.android.support:design:27.1.1'

androidTestImplementation project(path: ":detox")
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
implementation "com.facebook.react:react-native:+"
implementation 'com.android.support:design:27.1.1'

implementation fileTree(dir: "libs", include: ["*.jar"])

implementation project(':react-native-version-number')
implementation project(':react-native-sentry')
implementation project(':react-native-navigation')
implementation project(':react-native-code-push')
implementation project(':react-native-config')
implementation(project(':react-native-firebase')) {
transitive = false
}

androidTestImplementation project(path: ":detox")
androidTestImplementation 'junit:junit:4.12'
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
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
from configurations.compile
into 'libs'
}

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

// dependencies {
// // Local implementations
// implementation fileTree(dir: "libs", include: ["*.jar"])

// // Ueno RNS: Add your modules here
// implementation project(':react-native-version-number')
// implementation project(':react-native-sentry')
// implementation project(':react-native-navigation')
// implementation project(':react-native-code-push')
// implementation project(':react-native-config')
// implementation(project(':react-native-firebase')) {
// transitive = false
// }

// // implementation "com.google.android.gms:play-services-base:16.0.1"
// // implementation "com.google.firebase:firebase-core:16.0.1"

// // Other implementations
// implementation "com.android.support:design:27.0.2"
// implementation "com.android.support:appcompat-v7:27.0.2"
// implementation "com.android.support:support-annotations:27.0.2"
// implementation "com.android.support:multidex:1.0.1"
// implementation "com.facebook.react:react-native:+"

// // Test implementations
// androidTestImplementation project(":detox")
// androidTestImplementation 'junit:junit:4.12'
// 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
// // puts all compile dependencies into folder libs for BUCK to use
// task copyDownloadableDepsToLibs(type: Copy) {
// from configurations.compile
// into 'libs'
// }

// apply plugin: 'com.google.gms.google-services'
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<application
android:name=".MainApplication"
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.ueno.reactnativestarter;

import android.app.Application;
// import android.content.Context;
// import android.support.multidex.MultiDex;
import java.util.Arrays;
import java.util.List;

Expand All @@ -29,12 +27,6 @@

public class MainApplication extends NavigationApplication {

// @Override
// protected void attachBaseContext(Context base) {
// super.attachBaseContext(base);
// MultiDex.install(this);
// }

@Override
protected ReactGateway createReactGateway() {
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
Expand Down
86 changes: 0 additions & 86 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,89 +88,3 @@ task wrapper(type: Wrapper) {
gradleVersion = '4.10.2'
distributionUrl = distributionUrl.replace("bin", "all")
}

// // Top-level build file where you can add configuration options common to all sub-projects/modules.

// project.ext {
// minSdkVersion = 21
// compileSdkVersion = 27
// targetSdkVersion = 27
// buildToolsVersion = '28.0.3'
// }

// buildscript {
// ext.kotlinVersion = '1.3.0'

// repositories {
// google()
// jcenter()
// mavenLocal()
// mavenCentral()
// }
// dependencies {
// classpath 'com.android.tools.build:gradle:3.3.0'
// classpath 'com.google.gms:google-services:4.2.0'
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// classpath 'com.google.firebase:firebase-plugins:1.1.5'

// // NOTE: Do not place your application dependencies here; they belong
// // in the individual module build.gradle files
// }
// }

// allprojects {
// repositories {
// google()
// jcenter()
// mavenLocal()
// mavenCentral()
// maven {
// // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
// url "$rootDir/../node_modules/react-native/android"
// }
// maven {
// // Local Maven repo containing AARs with JSC library built for Android
// url "$rootDir/../node_modules/jsc-android/dist"
// }
// maven {
// url 'https://maven.google.com'
// }
// maven {
// url 'https://jitpack.io'
// }
// }
// }

// subprojects {
// task listAllDependencies(type: DependencyReportTask) {}

// ext {
// minSdk = 21
// targetSdk = 27
// compileSdk = 27
// buildTools = "28.0.3"
// }

// afterEvaluate { project ->
// if (!project.name.equalsIgnoreCase("app") && project.hasProperty("android")) {
// android {
// compileSdkVersion compileSdk
// buildToolsVersion buildTools
// defaultConfig {
// minSdkVersion minSdk
// targetSdkVersion targetSdk
// }
// variantFilter { variant ->
// def names = variant.flavors*.name
// if (names.contains("minReactNative44")) {
// setIgnore(true)
// }

// if (names.contains("reactNative51") || names.contains("reactNative55") || names.contains("reactNative57")) {
// setIgnore(true)
// }
// }
// }
// }
// }
// }
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// require('./src/index.ts');
require('./src/index.ts');

0 comments on commit b84b393

Please sign in to comment.