question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot build android flavors with a Development build

See original GitHub issue

Summary

I was following this documentation to configure a development/staging/production variants in a bare project, it works fine with iOS but not for android.

As soon as I add the flavors to my build.gradle I can’t run my application on android anymore.

Managed or bare workflow? If you have made manual changes inside of the ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

Android

Package versions

“expo-dev-client”: “~0.8.4”

Environment

expo-env-info 1.0.2 environment info: System: OS: macOS 12.3 Shell: 5.8 - /bin/zsh Binaries: Node: 14.19.0 - /usr/local/opt/node@14/bin/node Yarn: 1.22.18 - ~/.yarn/bin/yarn npm: 6.14.16 - /usr/local/opt/node@14/bin/npm Watchman: 2022.03.14.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: API Levels: 28, 30 Build Tools: 29.0.2, 30.0.2, 32.0.0 System Images: android-30 | Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: 13.3/13E113 - /usr/bin/xcodebuild npmPackages: expo: 44.0.2 => 44.0.2 react: 17.0.2 => 17.0.2 react-dom: 17.0.2 => 17.0.2 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.7 => 0.17.7 npmGlobalPackages: expo-cli: 5.3.0 Expo Workflow: bare

Reproducible demo

Here

Stacktrace (if a crash is involved)

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
esamelsoncommented, Mar 28, 2022

Thanks for the extra details @dogfootruler-kr , and for providing a repo. I’ve been able to reproduce the error and track down the source. We should have a fix out in the next release of the expo-dev-client package, but if this is blocking you in the meantime, you can add the fix from #16799 locally using patch-package.

1reaction
dogfootruler-krcommented, Mar 25, 2022

Hello @esamelson , sorry I completely forgot to share the error logs…

My eas.json looks like this:

{
  "cli": {
    "version": ">= 0.47.0"
  },
  "build": {
    "development": {
      "node": "14.19.1",
      "releaseChannel": "development",
      "developmentClient": true,
      "distribution": "internal",
      "android": {
        "gradleCommand": ":app:assembleDevelopmentDebug"
      }
    },
    "staging": {
      "node": "14.19.1",
      "releaseChannel": "staging",
      "distribution": "internal",
      "android": {
        "gradleCommand": ":app:assembleStagingRelease"
      }
    },
    "production": {
      "node": "14.19.1",
      "releaseChannel": "production",
      "android": {
        "gradleCommand": ":app:bundleProductionRelease"
      }
    }
  }
}

and I added the flavors in my app/build.gradle like this:

    flavorDimensions "env"
    productFlavors {
        production {
            dimension "env"
            applicationId 'com.myapp'
        }
        staging {
            dimension "env"
            applicationId 'com.myappstg'
        }
        development {
            dimension "env"
            applicationId 'com.myappdev'
        }
    }

and the error I get after running eas build -p android --profile development --local :

[CONFIGURE_EXPO_UPDATES] Setting the release channel in 'AndroidManifest.xml' to 'development'
[RUN_GRADLEW] Running './gradlew :app:assembleDevelopmentDebug' in /var/folders/4d/_cy79sx97kxf2c27f7pzjyhw0000gn/T/eas-build-local-nodejs/5a8619c7-42e5-4ec2-9702-e29ce5bf6ac7/build/android
[RUN_GRADLEW] > Configure project :expo-dev-menu
[RUN_GRADLEW] DevMenu will replace JNI library.
[RUN_GRADLEW] FAILURE: Build completed with 2 failures.
[RUN_GRADLEW] 1: Task failed with an exception.
[RUN_GRADLEW] -----------
[RUN_GRADLEW] * Where:
[RUN_GRADLEW] Build file '/private/var/folders/4d/_cy79sx97kxf2c27f7pzjyhw0000gn/T/eas-build-local-nodejs/5a8619c7-42e5-4ec2-9702-e29ce5bf6ac7/build/node_modules/expo-dev-menu/android/build.gradle' line: 105
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] A problem occurred evaluating project ':expo-dev-menu'.
[RUN_GRADLEW] > Task with path ':app:mergedevelopmentDebugNativeLibs' not found in project ':app'.
[RUN_GRADLEW] * Try:
[RUN_GRADLEW] Run with --stacktrace option to get the stack trace. Run with --info or --debug
[RUN_GRADLEW] option to get more log output. Run with --scan
[RUN_GRADLEW] to get full insights.
[RUN_GRADLEW] ==============================================================================
[RUN_GRADLEW] 2: Task failed with an exception.
[RUN_GRADLEW] -----------
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] A problem occurred configuring project ':expo'.
[RUN_GRADLEW] > compileSdkVersion is not specified. Please add it to build.gradle
[RUN_GRADLEW] * Try:
[RUN_GRADLEW] 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.
[RUN_GRADLEW] ==============================================================================
[RUN_GRADLEW] * Get more help at https://help.gradle.org
[RUN_GRADLEW] BUILD FAILED in 11s
[RUN_GRADLEW] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[RUN_GRADLEW] Use '--warning-mode all' to show the individual deprecation warnings.
[RUN_GRADLEW] See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
[RUN_GRADLEW] Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.

Build failed
Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.
    Error: npx exited with non-zero code: 1
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure build variants | Android Developers
Find out how you can configure build variants to create different versions of your app from ... Creating product flavors is similar to...
Read more >
android - Using Build Flavors - Structuring source folders and ...
I am trying to use different Build Flavors for one same Application project in Android Studio. However, I seem to be having a...
Read more >
Android Build Types and Product Flavors - DigitalOcean
In this tutorial, we'll be discussing Android Build Types and Product Flavors. We'll see how they make our Android Development easier and ...
Read more >
Build problem with multiple product flavours in new version ...
Following the update to the latest version of Android Studio, the Gradle sync fails with the error "Cannot find a variant matching build...
Read more >
Android: set a default build type/flavor | by Carlos Mota
Support for default build type/ flavor ... With the releases of Android Studio 3.5 and Gradle plugin 3.5.0 we now have support to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found