Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build expo project locally on a windows machine using Linux WSL

I am using a windows machine and running a linux wsl server. My project is an expo managed project. I want to build my project locally and not rely on the EAS servers.

I have opened a linux shell in my project directory and run the command:

eas build --platform android --profile production --local

But I get the error:

FAILURE: Build failed with an exception.
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] A problem occurred configuring root project 'myProjectName'.
[RUN_GRADLEW] > Could not determine the dependencies of null.
[RUN_GRADLEW] > Could not resolve all task dependencies for configuration ':classpath'.
[RUN_GRADLEW]       > Could not resolve com.android.tools.build:gradle:7.4.1.
[RUN_GRADLEW]         Required by:
[RUN_GRADLEW] project :
[RUN_GRADLEW]          > No matching variant of com.android.tools.build:gradle:7.4.1 was found. The consumer was configured to find
[RUN_GRADLEW] a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5.1' but:
[RUN_GRADLEW]              - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.1 declares
[RUN_GRADLEW] a library, packaged as a jar, and its dependencies declared externally:
[RUN_GRADLEW]                  - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed
[RUN_GRADLEW] a runtime of a component compatible with Java 8
[RUN_GRADLEW]                  - Other compatible attribute:
[RUN_GRADLEW]                      - Doesn't say anything about
[RUN_GRADLEW] org.gradle.plugin.api-version (required '7.5.1')
[RUN_GRADLEW]              - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.1 declares
[RUN_GRADLEW] a runtime of a component, and its dependencies declared externally:
[RUN_GRADLEW]                  - Incompatible because this component declares documentation and the consumer needed a library
[RUN_GRADLEW] - Other compatible attributes:
[RUN_GRADLEW]                      - Doesn't say anything about its target Java version (required compatibility with Java 8)
[RUN_GRADLEW] - Doesn't say anything about its elements (required them packaged as a jar)
[RUN_GRADLEW]                      - Doesn't say anything about
[RUN_GRADLEW] org.gradle.plugin.api-version (required '7.5.1')
[RUN_GRADLEW]              - Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
[RUN_GRADLEW] - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
[RUN_GRADLEW]                  - Other compatible attribute:
[RUN_GRADLEW]                      - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
[RUN_GRADLEW]              - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
[RUN_GRADLEW] - Incompatible because this component declares documentation and the consumer needed a library
[RUN_GRADLEW]                  - Other compatible attributes:
[RUN_GRADLEW]                      - Doesn't say anything about its target Java version (required compatibility with Java 8)
[RUN_GRADLEW]                      - Doesn't say anything about its elements (required them packaged as a jar)
[RUN_GRADLEW]                      - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
[RUN_GRADLEW]       > Could not resolve com.android.tools.build:gradle:7.3.1.
[RUN_GRADLEW]         Required by:
[RUN_GRADLEW] project : > project :react-native-gradle-plugin
[RUN_GRADLEW]          > No matching variant of com.android.tools.build:gradle:7.4.1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5.1' but:
[RUN_GRADLEW]              - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.1 declares a library, packaged as a jar, and its dependencies declared externally:
[RUN_GRADLEW]                  - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
[RUN_GRADLEW]                  - Other compatible attribute:
[RUN_GRADLEW]                      - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
[RUN_GRADLEW]              - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
[RUN_GRADLEW]                  - Incompatible because this component declares documentation and the consumer needed a library
[RUN_GRADLEW]                  - Other compatible attributes:
[RUN_GRADLEW]                      - Doesn't say anything about its target Java version (required compatibility with Java 8)
[RUN_GRADLEW]                      - Doesn't say anything about its elements (required them packaged as a jar)
[RUN_GRADLEW]                      - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
[RUN_GRADLEW]              - Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.1 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
[RUN_GRADLEW]                  - Incompatible because this component declares a component compatible with Java 11
[RUN_GRADLEW] and the consumer needed a component compatible with Java 8
[RUN_GRADLEW]                  - Other compatible attribute:
[RUN_GRADLEW]                      - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')
[RUN_GRADLEW]              - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.1 declares a runtime of a component, and its dependencies declared externally:
[RUN_GRADLEW]                  - Incompatible because this component declares documentation and the consumer needed a library
[RUN_GRADLEW]                  - Other compatible attributes:
[RUN_GRADLEW]                      - Doesn't say anything about its target Java version (required compatibility with Java 8)
[RUN_GRADLEW]                      - Doesn't say anything about its elements (required them packaged as a jar)
[RUN_GRADLEW]                      - Doesn't say anything about org.gradle.plugin.api-version (required '7.5.1')

java -version =

openjdk version "17.0.8.1" 2023-08-24
OpenJDK Runtime Environment (build 17.0.8.1+1-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 17.0.8.1+1-Ubuntu-0ubuntu122.04, mixed mode, sharing)

and

gradle -version =

------------------------------------------------------------
Gradle 7.4.1
------------------------------------------------------------

Build time:   2022-03-09 15:04:47 UTC
Revision:     36dc52588e09b4b72f2010bc07599e0ee0434e2e

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          1.8.0_382 (Private Build 25.382-b05)
OS:           Linux 5.10.16.3-microsoft-standard-WSL2 amd64

I hope someone can help. I'm tearing my hair out over this one! Thanks

like image 649
Neil Avatar asked Aug 31 '25 01:08

Neil


1 Answers

I have used Android studio on WSL.

  • sudo apt update && sudo apt install nodejs npm default-jre default-jdk

  • Install android studio - has to be done manually. Download it from their website and unpack.

    • wget https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2022.3.1.20/android-studio-2022.3.1.20-linux.tar.gz
    • tar -xvzf android-studio-2022.3.1.20-linux.tar.gz
    • cd android-studio
    • ./bin/studio.sh
    • complete setup on popup window
  • Set export paths to .bashrc

export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
like image 128
Kullar Avatar answered Sep 02 '25 18:09

Kullar