After removing code push from package.json. There is a lot of trace in ios and android package which are not going away.How can I remove code push completely?.
What actually happens?
some time npm install cause issue such as
"npm WARN enoent ENOENT: no such file or directory, open '/Users/albin.git/Desktop/itsman_app/node_modules/react-native-code-push/package.json'"
even after removing it from package.json
also running package separately on Xcode or android studio causes code-push error
Hi @Albinzr and thanks for submitting the issue. Please follow these steps:
npm uni --save react-native-code-push from the app directory
Android instructions
build.gradle:include ':app'/*, ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')*/
android/app/build.gradle...
dependencies {
...
//compile project(':react-native-code-push')
}
...
//apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
MainApplication.java//import com.microsoft.codepush.react.CodePush;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
...
/*
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
// new CodePush("deployment-key-here", MainApplication.this, BuildConfig.DEBUG)
);
}
};
}
or update MyReactActivity.java (select the way that is working for you)
...
//import com.microsoft.codepush.react.CodePush;
public class MyReactActivity extends Activity {
private ReactRootView mReactRootView;
private ReactInstanceManager mReactInstanceManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
...
mReactInstanceManager = ReactInstanceManager.builder()
// ...
//.addPackage(new CodePush("deployment-key-here", getApplicationContext(), BuildConfig.DEBUG))
//.setJSBundleFile(CodePush.getJSBundleFile())
// ...
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);
setContentView(mReactRootView);
}
...
}
res/values/string.xml related with CodePush (if it exists)
iOS instructions
If you installed Codepush via cocoapods
pod install again.CodePush from Info.plistIf you installed Codepush manually
CodePush.xcodeproj from Libraries directorySSZipArchive, JWT, Base64libCodePush.a and libz.tbd (or remove the -lz flag from the Other Linker Flags field in the Linking section of the Build Settings) from Link binary with libraries list.Common steps
AppDelegate.m// #import <CodePush/CodePush.h>
...
//#ifdef DEBUG
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.bundle?platform=ios&dev=true"];
//#else
// jsCodeLocation = [CodePush bundleURL];
//#endif
Info.plist (remove <key>codepush.azurewebsites.net</key>)
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>codepush.azurewebsites.net</key>
</dict>
</dict>
<!-- ...other configs... -->
Please let us know if it helps or any updates.
Thanks @ruslan-bikkinin, Adding this to Documentation will be great.
Most helpful comment
Hi @Albinzr and thanks for submitting the issue. Please follow these steps:
npm uni --save react-native-code-pushfrom the app directoryAndroid instructions
build.gradle:android/app/build.gradleMainApplication.javaor update
MyReactActivity.java(select the way that is working for you)res/values/string.xmlrelated with CodePush (if it exists)iOS instructions
If you installed Codepush via cocoapods
pod installagain.CodePushfromInfo.plistIf you installed Codepush manually
CodePush.xcodeprojfromLibrariesdirectorySSZipArchive,JWT,Base64libCodePush.aandlibz.tbd(or remove the -lz flag from the Other Linker Flags field in the Linking section of the Build Settings) fromLink binary with librarieslist.Common steps
AppDelegate.mInfo.plist(remove<key>codepush.azurewebsites.net</key>)Please let us know if it helps or any updates.