Skip to content

Commit

Permalink
Updated packages and Gradle configuration
Browse files Browse the repository at this point in the history
* Updated packages:
  * react: ^16.3.2 (was ^16.3.0-alpha.1)
  * react-native: ^0.54.4 (was ^0.54.4)
  * native-base: "^2.4.4 (was ^2.4.2)
  * redux: ^4.0.0 (was ^3.7.2)
  * react-test-renderer: ^16.3.2 (was 16.3.0-alpha.3)
  * NOTE: I read the update notes and these should be safe changes,
    including "redux", which got a major version update.

* Gradle-related changes:
  * Changed the way how the SDK is defined in the Gradle configuration:
    Now this is configured globally in `/android/build.gradle`, which
    gets rid of the version warnings.
  * Updated Gradle to version 4.4 (was 4.1).
  * Updated the Gradle plugin to version 3.1 (was 3.0.1).

INSTALLATION STEPS:
===================
rm package-lock.json
rm node_modules
npm install --no-optional  // (NOTE: "--no-optional" needed on Windows)

TROUBLESHOOTING:
================
* If there are any errors like "could not delete folder x", remove those
  folders manually, e.g.:
    rm C:\r3\android\app\build\intermediates\incremental\processDebugResources
    rm C:\r3\android\app\build\generated\source\r\debug\org\webkit

* If there are errors like "unable to create folder x", try again. It
  should work on the second time.

READ
====
* Main motivation:
  * We should have an SDK version which is at least v26, since that will
    be the minimum to be accepted in the Play store after August 2018:
      facebook/react-native#17287
      facebook/react-native#19297
  * Regarding Gradle, the latest versions are required to build for the
    lastest SDKs, but will also increase compilation time a lot:
      facebook/react-native#15448

* React Native Maps installation and Gradle upgrade instructions:
    https://itnext.io/install-react-native-maps-with-gradle-3-on-android-44f91a70a395

* Migration instructions for the Android Gradle Plugin v3.0.0:
    https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration

* List of versions of the Android Gradle Plugin and upgrade steps:
    https://developer.android.com/studio/releases/gradle-plugin
  • Loading branch information
samuel-h-r-nunes committed May 17, 2018
1 parent 0167ccc commit 983ef9a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Expand Up @@ -100,8 +100,8 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.r3"
Expand Down
2 changes: 0 additions & 2 deletions android/app/src/main/java/com/r3/MainApplication.java
Expand Up @@ -5,8 +5,6 @@
import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
Expand Down
20 changes: 18 additions & 2 deletions android/build.gradle
@@ -1,12 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

ext {
compileSdkVersion = 27 // Or what version you want (latest is recommended)
buildToolsVersion = '27.0.3' // same thing
}

subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}

buildscript {
repositories {
maven {url 'https://maven.google.com'}
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
4 changes: 0 additions & 4 deletions android/settings.gradle
Expand Up @@ -3,9 +3,5 @@ include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')

include ':app'
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -8,23 +8,23 @@
"lint": "standard"
},
"dependencies": {
"native-base": "^2.4.2",
"native-base": "^2.4.4",
"prop-types": "^15.6.1",
"react": "^16.3.0-alpha.1",
"react-native": "^0.54.0",
"react": "^16.3.2",
"react-native": "^0.54.4",
"react-native-maps": "^0.21.0",
"react-native-material-ui": "^1.22.2",
"react-native-vector-icons": "^4.6.0",
"react-navigation": "^1.5.11",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"redux": "^4.0.0",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.0-alpha.3",
"react-test-renderer": "^16.3.2",
"standard": "^11.0.1"
},
"jest": {
Expand Down

0 comments on commit 983ef9a

Please sign in to comment.