Skip to content

Commit

Permalink
changes link file on Android to MainApplication.java for 0.29 update
Browse files Browse the repository at this point in the history
Summary:
rnpm aka `react-native link` is broken with Android 0.29 - #8603

This gets it back to working again by checking for new MyApplication.java file, and curtailing the path when needed.
Closes #8612

Differential Revision: D3533960

fbshipit-source-id: 95d799eaebb26ba1d876c88107ccd2af72427f55
  • Loading branch information
GantMan authored and grabbou committed Jul 13, 2016
1 parent 4d70b85 commit 214a41d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions local-cli/rnpm/core/src/config/android/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ exports.projectConfig = function projectConfigAndroid(folder, userConfig) {
const packageFolder = userConfig.packageFolder ||
packageName.replace(/\./g, path.sep);

const mainActivityPath = path.join(
const mainFilePath = path.join(
sourceDir,
userConfig.mainActivityPath || `src/main/java/${packageFolder}/MainActivity.java`
userConfig.mainFilePath || `src/main/java/${packageFolder}/MainApplication.java`
);

const stringsPath = path.join(
Expand Down Expand Up @@ -68,7 +68,7 @@ exports.projectConfig = function projectConfigAndroid(folder, userConfig) {
buildGradlePath,
settingsGradlePath,
assetsPath,
mainActivityPath,
mainFilePath,
};
};

Expand Down

1 comment on commit 214a41d

@lotosbin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/facebook/react-native/blob/0.29-stable/local-cli/rnpm/link/src/android/registerNativeModule.js#L29-L37

 applyPatch(
    projectConfig.mainActivityPath, // still mainActivityPath?
    makePackagePatch(androidConfig.packageInstance, params, name)
  );

  applyPatch(
    projectConfig.mainActivityPath, // still mainActivityPath?
    makeImportPatch(androidConfig.packageImportPath)
  );

@GantMan

Please sign in to comment.