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.

Android build APK breaking on config

See original GitHub issue

I’m attempting to run ./gradlew assembleRelease in the android directory of my react-native app to build the APK. I expect the following code to replace my config files across the app however it’s not resolving properly.

webpack.haul.js

const path = require("path");

module.exports = ({ platform, root }, defaults) => ({
  entry: `./index.${platform}.js`,
  resolve: {
      ...defaults.resolve,
      alias: {
          ...defaults.resolve.alias,
          config: path.join(root, 'config')
      }
  }
});

App.js

import React from 'react';
import {Text, View} from 'react-native';
import config from 'config';

// more code below...

When I run I get the following error:

Unable to resolve module `config` from `/Users/brendan/Projects/<project-name>/App.js`: Module does not exist in the module map or in these directories:
  /Users/brendan/Projects/<project-name>/node_modules

It seems to be working fine for the iOS build however for Android this issue is being thrown.

Your Environment

software version
Haul ^1.0.0-beta.1
react-native ^0.44.0
node v8.0.0
yarn 0.21.3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Ble3kcommented, Nov 29, 2017

I had the same problem and solved it just by adding project.ext.react = [ cliPath: "node_modules/haul/bin/cli.js" ] as it said in docs.

0reactions
jurbycommented, Jan 23, 2018

I had the same problem and solved it just by adding: // Haul project.ext.react = [ root: "../../", cliPath: "node_modules/haul/bin/cli.js" ]

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android, Build Successful, but apk build (subsequent run) fails
I recently upgraded to Android studio 1.2 beta. Projects that compiled fine earlier, broke. I had to make some modifications in the gradle ......
Read more >
Build and run your app - Android Developers
In the toolbar, select your app from the run configurations menu. ... You build the APK of your app using a debug build...
Read more >
Create and edit run/debug configurations - Android Developers
Android Studio can create a run/debug configuration for some items displayed in the Project window. The configuration is based on a default template,...
Read more >
Known issues with Android Studio and Android Gradle Plugin
Find out about current known issues with Android Studio and the Android Gradle ... navigate to Build > Generate Signed Bundle / APK...
Read more >
Debug pre-built APKs - Android Developers
Known issue: When attaching debug symbols to an APK, both the APK and debuggable .so files must be built using the same workstation...
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