Hi @all. A few days ago I started trying to get electrode-native up and running and since I failed to do so following their getting started guide, I decided to make my own and share it with the developers that want to go the same path. This post will be only a series of the steps I followed to make it work in my environment which is Kubuntu 17.10 OS. Here is all that I did.
For some reason, electrode-native depends on gnome-terminal so do
apt-get install gnome-terminal if you are not running a Gnome based system.
apt-get install git
apt-get install openjdk-8-jdk
- Download the latest version of AndroidStudio and install SDK
- Export variables ANDROID_HOME and ANDROID_SDK pointing to the Android SDK directory
- Add tools and platform-tools folders to PATH
- Download Android system image to run your application or just use your Android phone to test
- Download the latest Gradle release
- Unzip somewhere in your system
mkdir /opt/gradle unzip -d /opt/gradle gradle-4.6-bin.zip
- Export GRADLE_HOME to the folder you extracted
- Add GRADLE_HOME/bin to PATH
- note: electrode will probably download its own Gradle version anyway
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs sudo apt-get install -y npm
- Install electrode-native from npm
npm install -g electrode-native
- Install yarn
npm install -g yarn
- Run ern for the first time to complete installation
- Installing react-native tools might be needed
npm install -g create-react-native-app
To start building your first miniapp run
ern create-miniapp MyGreatApp And after it finishes run
ern run-android to start the application. You can run either on emulator or physical device.
Are you working with your device connected to your computer?
- Ensure adb access. When you run
adb devicesyour device should show in the list like this :
~$ adb devices List of devices attached b91feec4 device
If you can't see your device in the list or it says anything but device try disconnecting and connecting again and checking if you have USB debugging active.
- Run a tunnel from localhost to the device like this:
adb reverse tcp:8081 tcp:8081
An error occurred: Command failed: ./gradlew lib:uploadArchives Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78) at org.gradle.wrapper.Install.createDist(Install.java:44) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:58) Caused by: java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:225) at java.util.zip.ZipFile.<init>(ZipFile.java:155) at java.util.zip.ZipFile.<init>(ZipFile.java:169) at org.gradle.wrapper.Install.unzip(Install.java:157) at org.gradle.wrapper.Install.access$400(Install.java:26) at org.gradle.wrapper.Install$1.call(Install.java:67) at org.gradle.wrapper.Install$1.call(Install.java:44) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65) ... 3 more
Solution: Probably Gradle did not download correctly. Delete
/home/$USER/.gradle/wrapper/dists/gradle-4.1-all and try running the project again.
Try deleting your Gradle cache (usually on /home/$USER/.gradle) and trying to run again
I want to thank Benoit Lemaire for helping me when I was stuck having issues with Gradle.
Thank you very much for reading. I hope you enjoyed this post and find helpful.