Saturday, January 27, 2018

Possible solutions to getting react native app built

This document is a work in progress, I'm documenting the errors and pitfalls of developing in react native under Ubuntu. This is documented in the hope that someone finds this useful or if I need to refer to this again at some point in the future.

I am by no means an expert in this, I'm documenting what I have encountered and what had worked for me. I only advise that you can try these out at your own risk, as I cannot accept any responsibility.

Issue: Could not determine java version from '9.0.1'.


Solution :
From your project directory navigate to the directory "android/gradle/wrapper" and edit the file gradle-wrapper.properties and update the distributionUrl to the following :

distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip

Issue: Sdk location not found


Solution : From your project directory navigate to the android directory and edit the file local.properties (create it if it isn't there)

sudo nano local.properties

then enter the following line and replace <username> with your username

sdk.dir = /home/<username>/Android/Sdk

Issue : Failed to notify project evaluation listener.  javax/xml/bind/annotation/XmlSchema


Solution : Downgrade from Java 9 to Java 8

sudo apt-get remove oracle-java9-installer
sudo apt-get install oracle-java8-installer


if it comes back with an error for oracle-java7-installer then run the following command:

sudo dpkg -P oracle-java7-installer
sudo apt-get -f install 


Issue : ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-9-oracle


Solution : 

find the java location using 

readlink -f $(which java)

copy the path without the bin/java at the end and run this command and paste the path 

export JAVA_HOME="<path>"

Issue: The SDK Build Tools revision (23.0.1) is too low for project ':app'. Minimum required is 25.0.0

Solution : 

from your project file goto android directory and edit build.gradle file and insert the following :

subprojects { subproject ->
    afterEvaluate{
        if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion 25
                buildToolsVersion "25.0.1"
            }
        }
    }
}

Issue: /bin/sh: 1: adb: not found


Solution : 
Update your path to point to your platform tools


Issue: Double Tap R to reload - How? 


Soution : I used CTRL + M, and menu shade will be displayed where you can choose to reload. 



0 comments:

Post a Comment