So I'm trying to deploy my React Native app using the App Center and integrate Code Push.
I installed the App Center SDK and workds properly but the problem comes when I add the Code Push plugin. It compiles the project nicely and does the sync too, but when I try to install it on my device the build falis saying:
"Process 'command 'node'' finished with non-zero exit value 1"
and "Error: ENOENT: no such file or directory, open '/home/balistic/Documents/sharryup/android/app/build/intermediates/assets/debug/CodePushHash'"
I'm using React Native 0.56.
There is a workaround for this:
In {project_dir}/node_modules/react-native-code-push/android/codepush.gradle (~86-90) just add this three lines:
generateBundledResourcesHash = tasks.create(
name: "generateBundledResourcesHash${targetName}",
type: Exec) {
+doFirst {
+jsBundleDir.mkdirs()
+}
commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/react-native-code-push/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir, resourcesMapTempFileName)
}
Related
I don't have much knowledge about Android.
I am using nativescript-vue and nativescript is 8.x version.
When I first create the ns-vue template and run the "ns run android" or "ns debug android" command, the app is installed on the connected device and runs automatically.
However, if I enter "ns run android" after setting up the Firebase, the install will be successful but the app will not run.
Running "ns debug android --debug-brk" results are the same and no errors appear on the console.
I just created the Firebase project and followed the stated flow.
Firebase setup flow I did:
I changed the package value in the file "App_Resources/Android/src/main/AndroidManifest.xml".
firebase: "com.xx.xx"
before AndroidManifest.xml: "\\PACKAGE\\"
after AndroidManifest.xml: "com.xx.xx"
I downloaded "Google-services.json" and copied it to the "platforms/android/app" folder.
I added applic plugin: 'com.Google.gms.Google-services' to the first line of "App_Resources/Android/app.gradle" and injected two dependencies.
implementation platform('com.google.firebase:firebase-bom:28.2.0')
implementation 'com.google.firebase:firebase-analytics'
I added classpath 'com.Google.gms:Google-services:4.3.8' from "platforms/android/build.gradle".
When I run the "ns run android" or "ns run debug" command, no errors appear and the "Successfully installed on device" log is displayed, but the app does not run.
No event occurs even if I launch the app.
I made the #loaded event call alert function and wrapped it with a try-catch phrase, but I can't see any error log or alert.
What I've tried:
ns run android --clean
ns run debug --debug-brk
ns build --release --aab --copy-to=[path] → aab to apks → install pak → no alert
ns clean
Try connecting to the actual device, turning off wifi.
Turn it to the emulator. (API 30)
I created a new project and tried the same thing, but the results didn't change.
Afterwards, I return the app.gradle, build.gradle to its original state and delete the Google-services.json file, but the app does not run automatically.
What did I miss?
ps. I know that there is a nativescript-firebase plug-in.
+I created a template with ns create my-blank-vue --template #nativescript/template-blank-vue.
finally i found problem.
Problem:
I changed the package value in the file "App_Resources/Android/src/main/AndroidManifest.xml".
firebase: "com.xx.xx"
before AndroidManifest.xml: "__PACKAGE__"
after AndroidManifest.xml: "com.xx.xx"
but Nativescript doc:
The NativeScript CLI build system will set them as the package attribute in the generated project in platforms/android/src/main/AndroidManifest.xml. In the app/App_Resources/Android/AndroidManifest.xml it will use a placeholder: package="__PACKAGE__". Do not modify the package attribute there.
Solved:
I reverted the file App_Resources/Android/src/main/AndroidManifest.xml like this: package="__PACKAGE__"
update package value from platforms/android/src/main/AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company.app" ...>
add applicationId properties same with package name to App_Resources/Android/src/main/app.gradle:
android {
defaultConfig {
applicationId "com.company.app"
minSdkVersion 17
generatedDensities = []
}
update id from nativescript.config.ts file:
id: 'com.company.app' // match application id
cmd: ns platform remove android; ns prepare android
Refernce:
https://docs.nativescript.org/releasing#overview
https://developer.android.com/studio/build/application-id?hl=ko
Issue Description
I installed the library via npx react-native link react-native-navigation (and modifying the minSdkVersion in andoid/build.gradle).
When I run npx react-native run-android, the app is built and works fine, though I get the following error in the terminal:
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-navigation (to unlink run: "react-native unlink react-native-navigation")
Since the lib has been linked manually, I add an entry in the react-native.config.js file to prevent react native to try to autolink the lib, as in:
module.exports = {
dependencies: {
'react-native-navigation': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
},
}
}
};
Now, the CLI error is not longer shown and the app is successfully built, but I get an error in the emulator:
TypeError: null is not an object (evaluating "this.nativeCommandsModule.setRoot()").
Which comes about at my first Navigation.setRoot(...); call:
[index.js]
const start = () => {
Navigation.events().registerAppLaunchedListener(() => {
registerScreens();
gotoInitialising();
// gotoLogin();
});
};
start();
My question is, what extra step should I take to get the lib to work and to not have a React Native CLI error, at the same time.
Environment
React Native Navigation version: 6.0.1
React Native version: 0.61.5
Platform(s) (iOS, Android, or both?): Android
Device info (Simulator/Device? OS version? Debug/Release?): Android emulator API 28 - (emulator version 29.2.1-5889189) - Debug build
FYI, since react-native-navigation#6.1.0, the link script has been fixed to update the minSDK for android as well.
Also you should not add react-native-navigation in react-native.config.js as the RNN library is required to be used in your native code. The team has updated the documentation to make the installation guide clearer: https://wix.github.io/react-native-navigation/docs/installing. If you follow the guide, it should be quite straightforward.
run the following command: react-native unlink react-native-navigation
When I build my Android app using AppCenter I get the following error message.
Has anyone seen this and if so how did they solve the issue?
What went wrong:
Execution failed for task ':app:bundleDevMinSdkDevKernelReleaseExpoAssets'.
Process 'command './node_modules/expokit/detach-scripts/run-exp.sh'' finished with non-zero exit value 127
Some people might have forgot to install expo-cli. Please make sure you have expo installed before build.
The issue for me was that I was trying to build an expo project.. I’ve since found out that these are not supported in app centre.
Solution 1:
first step
expo publish
second step
cd android && ./gradlew assemble
Solution 2:
remove ios bundleIdentifier and android package from app.json
eject project
make sure publishBundlePath and publishManifestPath in
app.json
try now Solution 1:
app.json
{
"expo": {
...
"ios": {
"bundleIdentifier": "com.example.org",
"publishBundlePath": "ios/chalhoub/Supporting/shell-app.bundle",
"publishManifestPath": "ios/chalhoub/Supporting/shell-app-manifest.json"
},
"android": {
"package": "com.example.org",
"publishBundlePath": "android/app/src/main/assets/shell-app.bundle",
"publishManifestPath": "android/app/src/main/assets/shell-app-manifest.json"
}
}
}
I try run a blank project from hours, and I do not understand what is wrong.
I have the file app.json in my project folder :
{
"sdkVersion" : "19.0.0"
}
and when I try :
expo start
I have this message :
PS D:\Projects\VSCode\AwesomeProject> expo start
Starting project at D:\Projects\VSCode\AwesomeProject
Expo DevTools is running at http://localhost:19002
Error: Missing app.json. See https://docs.expo.io/
No Expo configuration found. Are you sure this is a project directory?
PS D:\Projects\VSCode\AwesomeProject>
If I try
expo android
I get this :
PS D:\Projects\VSCode\AwesomeProject> expo android
Error: Missing app.json. See https://docs.expo.io/
There is an error with your project. See above logs for information.
Set EXPO_DEBUG=true in your env to view the stack trace.
- Making sure project is set up correctly...
PS D:\Projects\VSCode\AwesomeProject>
This is a blank project, i do not understand what is going wrong. How can I found sdkversion in use ? I thought It was the error, but I am not sure.
Thank you for your help
looks like that was generated with react-native init and not expo, because it doesn't have an "expo" section. we should provide a better error message in this case.
{
"expo": {
"sdkVersion": "32.0.0"
...
}
}
It's part of the project I just made.
I solved this problem by adding sdkVersion, as you can see in the image
I am trying to use nativescript-sound package in my nativescript/vue-cli based app.I install nativescript-sound using
npm install --save nativescript-sound
After installing this i run npm clean and than try to call nativescript-sound on my project's main.js file
require("nativescript-vue").registerElement("sound", () => require("nativescript-sound").sound);
When i try to run
npm run watch:android
compiler showing me error.
Error
ERROR in ./src/main.js
Module not found: Error: Can't resolve 'nativescript-sound' in
'/home/darahat/Desktop/Rhymes/src'
# ./src/main.js
My Question is why it showing error?
Is nativescript-sound support nativescript/vue cli?
If not support which plugin i can use to add background sound and
click button sound?
I changed in
node_modules/nativescript-sound/package.json
"main": "sound.js",
to
"main": "sound",
and it works!
let Sound = require("nativescript-sound");