Gimly-Blockchain / rn-did-siop-example-app

React Native test app for SIOP flow
3 stars 0 forks source link

Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup #2

Open happy-dev opened 1 year ago

happy-dev commented 1 year ago

Hi,

I'm a participant to the ONTOCHAIN ecosystem batch n°3. I'm trying to get the app running locally, so I can then integrate that feature into the Startin'blox framework.

I fail however to install it on my phone. When I issue the following command:

yarn android --verbose

I get:

yarn run v1.22.19
$ react-native run-android --verbose
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1037 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
debug Running command "cd android && ./gradlew app:installDebug -PreactNativeDevServerPort=8081"

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: spawn ./gradlew EACCES
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I've ensured I had Android Studio installed and that adb is on my $PATH. When I type:

adb devices

I get:

List of devices attached
5f0834b9    device

I followed the https://reactnative.dev/docs/environment-setup link but to no avail.

Can you help me?

cfontana0 commented 1 year ago

Hi Alex, Thanks for your message.

To compile the project, please follow the next steps:

  1. Clone

  2. Install & run nodeify

yarn install
yarn nodeify
  1. Change gradlew permissions
chmod 755 android/gradlew
  1. Add extra config to the rn-did-siop-example-app/android/build.gradle file
allprojects {
  ...
  configurations.all {
    resolutionStrategy {
      force "com.facebook.react:react-native:0.65.1"
    }
  }
...
  1. Build the project
yarn android

In case you are still gettings errors during the build build process, run the following commands:

npx jetify
yarn android

or

yarn android --no-jetifier

Let me know! Charlie

happy-dev commented 1 year ago

Thank you for your response @cfontana0

Here is my build.gradle file:

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
    configurations.all {
      resolutionStrategy {
        force "com.facebook.react:react-native:0.65.1"
      }
    }
}

Here is what I get when I run yarn android:

yarn run v1.22.19
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1037 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
error Failed to launch emulator. Reason: Emulator exited before boot..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...

> Configure project :react-native-os
WARNING:: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.

> Configure project :react-native-tcp
WARNING:: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project 'OPClientTester', project ':app', project ':react-native-camera', ...

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/alexbourlier/GimlyID/rn-did-siop-example-app/android/local.properties'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

I'm not sure what to set the ANDROID_SDK_ROOT environment variable at. Do you know?

I'm on MacOS if that helps

balessan commented 1 year ago

@happy-dev : does that Stack-overflow answers helps: https://stackoverflow.com/questions/29391511/where-is-android-sdk-root-and-how-do-i-set-it/48957437#48957437 ?

Answer specific to MacOS but just a guess as I do not know anything about Android development. Looks like it is a global environment variable though.

happy-dev commented 1 year ago

@balessan Ah ah, I'm happy you're here Can you take over here?

You'll be much more productive than me I tried to move forward as much as possible without bothering you but I have to face this harsh reality that... it probably works better when you do it. I'm officially only good at doing Google Slides... That's a bit hard to take

Call me if you need some directions here but I was trying to install this app to have a concrete code implementation running locally.

My plan was then to dig into the code and figure what needs to be added to Startin'blox in order to become GimlyID compatible. Writing this, I realize how naive I was to think I'll manage to do all this on my own ☺️

cfontana0 commented 1 year ago

Hi @happy-dev sorry that I didn't back to you early.

Were you able to manage it?