Skip to content

Commit

Permalink
Merge pull request #797 from renative-org/fix/android-wear-release
Browse files Browse the repository at this point in the history
fix(Android Wear): ExtraTranslation error and incorrect bundle file on release build
  • Loading branch information
pavjacko authored Feb 2, 2022
2 parents 6565a7f + 60db646 commit f41c333
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<resources>
<string name="app_name">{{APP_TITLE}}</string>
<!--
This string is used for square devices and overridden by hello_world in
values-round/strings.xml for round devices.
-->
<string name="hello_world">Hello ReNativeSquare!</string>
</resources>
20 changes: 5 additions & 15 deletions packages/rnv-sdk-android/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ const { executeAsync, execCLI } = Exec;
const {
getAppFolder,
getConfigProp,
getAppId
getAppId,
getEntryFile
} = Common;
const { isPlatformActive, createPlatformBuild } = PlatformManager;
const { generateEnvVars } = EngineManager;
Expand All @@ -86,18 +87,7 @@ const {
CLI_ANDROID_ADB
} = Constants;

const _getEntryOutputName = (c: any) => {
// CRAPPY BUT Android Wear does not support webview required for connecting to packager. this is hack to prevent RN connectiing to running bundler
const { entryFile } = c.buildConfig.platforms[c.platform];
// TODO Android PROD Crashes if not using this hardcoded one
let outputFile;
if (c.platform === ANDROID_WEAR) {
outputFile = entryFile;
} else {
outputFile = 'index.android';
}
return outputFile;
};


export const packageAndroid = async (c: any) => {
logTask('packageAndroid');
Expand All @@ -110,7 +100,7 @@ export const packageAndroid = async (c: any) => {
return true;
}

const outputFile = _getEntryOutputName(c);
const outputFile = getEntryFile(c, platform);

const appFolder = getAppFolder(c);
let reactNative = c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native';
Expand Down Expand Up @@ -589,7 +579,7 @@ export const configureProject = async (c: any) => {
return true;
}

const outputFile = _getEntryOutputName(c);
const outputFile = getEntryFile(c, platform);

mkdirSync(path.join(appFolder, 'app/src/main/assets'));
fsWriteFileSync(
Expand Down
6 changes: 3 additions & 3 deletions packages/rnv-sdk-android/src/kotlinParser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { FileUtils, Logger, Common } from 'rnv';
import { Common, FileUtils, Logger } from 'rnv';

const {
getAppFolder,
Expand All @@ -15,7 +15,7 @@ const { logWarning } = Logger;
const { writeCleanFile } = FileUtils;

const JS_BUNDLE_DEFAULTS: any = {
// CRAPPY BUT Android Wear does not support webview required for connecting to packager
// Android Wear does not support webview required for connecting to packager. this is hack to prevent RN connectiing to running bundler
androidwear: '"assets://index.androidwear.bundle"'
};

Expand All @@ -26,7 +26,7 @@ export const parseMainApplicationSync = (c: any) => {
const bundleAssets = getConfigProp(c, platform, 'bundleAssets');
const bundleDefault = JS_BUNDLE_DEFAULTS[platform];
const bundleFile: string = getGetJsBundleFile(c, platform) || bundleAssets
? '"assets://index.android.bundle"'
? `"assets://${getEntryFile(c, platform)}.bundle"`
: bundleDefault || '"super.getJSBundleFile()"';
const bundlerIp = getIP() || '10.0.2.2';
if (!bundleAssets) {
Expand Down

0 comments on commit f41c333

Please sign in to comment.