Comments (8)
Hello @harshitmahendra thank you for your time, I started from scratch and ran into the same problem, for some reason android is using old cache of the code, so before you run react-native run-android --variant=release
run one more command. Please notify if successful
TLDR:
- Open terminal pointing to
magento_react_native
folder - Run command
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
- Important: Delete these files manually if created after step no. 2
android/app/src/main/res/drawable-hdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
android/app/src/main/res/drawable-mdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
android/app/src/main/res/drawable-mdpi/node_modules_reactnavigationstack_lib_module_views_assets_backiconmask.png
android/app/src/main/res/drawable-xhdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
android/app/src/main/res/drawable-xxhdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
android/app/src/main/res/drawable-xxxhdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
- Cd into android folder
cd android/
- Generate the release APK by running command
./gradlew bundleRelease
- To test the release build of your app run
cd .. && react-native run-android --variant=release
After successful build, you will see that Appbar
color is blue
not white
and there is only two icon on right side search
and cart
icon, that means you are running latest changes
Clone repo
- clone repo
git clone https://github.com/alexakasanjeev/magento_react_native.git
- cd into the project and run
npm install
Run debug build
- In terminal run
npm start
- In separate terminal run
react-native run-android
If you get this error
Task :react-native-gesture-handler:compileDebugJavaWithJavac magento_react_native/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerStateChangeEvent.java:3: error: package androidx.core.util does not exist import androidx.core.util.Pools;
do this
2.1 run this commandnpm uninstall react-native-gesture-handler
2.2 after that runnpm install [email protected]
then try again
Run release build
- Open terminal pointing to
magento_react_native
folder - Go into android folder by running
cd android/
in terminal - run
keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
remember the keystore and key password
- Place the
my-upload-key.keystore
file under theandroid/app
directory in your project folder. - Edit the file
~/.gradle/gradle.properties
orandroid/gradle.properties
, and add the following (replace*****
with the correct keystore password, alias and key password),
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=*****
MYAPP_UPLOAD_KEY_PASSWORD=*****
- Edit the file
android/app/build.gradle
in your project folder, and add the signing config
...
android {
...
defaultConfig { ... }
signingConfigs {
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
}
}
...
- Move out of the android folder in terminal by running
cd ..
- Run command
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
- Important: Delete these files manually if created after step no. 8
android/app/src/main/res/drawable-hdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
android/app/src/main/res/drawable-mdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
android/app/src/main/res/drawable-mdpi/node_modules_reactnavigationstack_lib_module_views_assets_backiconmask.png
android/app/src/main/res/drawable-xhdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
android/app/src/main/res/drawable-xxhdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
android/app/src/main/res/drawable-xxxhdpi/node_modules_reactnavigationstack_lib_module_views_assets_backicon.png
- Cd into android folder
cd android/
- Generate the release APK by running command
./gradlew bundleRelease
(make sure you are in android folder in terminal) - To test the release build of your app run
cd .. && react-native run-android --variant=release
from magento_react_native.
@alexakasanjeev you probably missed this easy way to remove console.log
from production build https://facebook.github.io/react-native/docs/performance
from magento_react_native.
Problem: In release log
function in src/magento/index.js
was being set null, hence throwing error 🤦♂️
from magento_react_native.
from magento_react_native.
thank you, will implement it in code :)
from magento_react_native.
still it's not working, I tried to make a build with using android:usesCleartextTraffic="true" in AndroidManifest.xml still getting the same error
from magento_react_native.
hi @harshitmahendra
Can you please make sure you have following things setup.
- Make sure you have latest pull from develop branch and it has specific commit
8aabe42347b9752d80e266715d974761cb487fae
- in
src/magento/index.js
their is used ofconsole.log('...');
statement and notlog('...'); //wrong
statement
Also is this the release build or debug you are checking?
from magento_react_native.
hello @alexakasanjeev
-
I have the latest pull from develop branch which has
console.log
insrc/magento/index.js
file. -
I Tried to make a release APK using the following steps :
a. I copied mymy-upload-key.keystore
to android/app
b. Then I go to android folder ingradle.properties
and pasted this :
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore MYAPP_UPLOAD_KEY_ALIAS=my-key-alias MYAPP_UPLOAD_STORE_PASSWORD=123456 MYAPP_UPLOAD_KEY_PASSWORD=123456
c. Then I go toandroid/app
inbuild.gradle
file and pasted this code to my file :
... android { ... defaultConfig { ... } signingConfigs { release { if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) { storeFile file(MYAPP_UPLOAD_STORE_FILE) storePassword MYAPP_UPLOAD_STORE_PASSWORD keyAlias MYAPP_UPLOAD_KEY_ALIAS keyPassword MYAPP_UPLOAD_KEY_PASSWORD } } } buildTypes { release { ... signingConfig signingConfigs.release } } } ...
d. then I go toAndroidManifest.xml
and pasted thisandroid:usesCleartextTraffic="true"
under application tag
e. Then run the following command in a terminal:
cd android/ && sudo ./gradlew assembleRelease
f. Then I found BUILD SUCCESSFUL in my Terminal, Then I go to
android/app/build/outputs/apk/release
and FOUND app-release.apk in that folder.
Then I send this via Whatsapp and then run this apk to my [Honor play] mobile. The above
screenshot is from my phone
The app is running when i tried react-native run-android
in my terminal, but it's not working in release APK..
from magento_react_native.
Related Issues (20)
- Add API logger
- Build failled HOT 7
- metro bundler isn't running with `react-native run-ios` HOT 4
- Add Bottom Tabs
- Test react-native-vector-icons v7 lib on iOS
- Upgrade RN version to 0.63.0 HOT 2
- Create Photo Viewer for Product Screen
- I facing issue when build the app. cant get product.sku. HOT 3
- Facing issue on APP didnt show image. HOT 10
- Unexpected token, expected "," CatalogGridItem HOT 8
- No such entity with customerId = 2 HOT 6
- Dark theme support
- error HOT 1
- Build Failed
- How can I use another api? For example, I want to use Django
- package json broken
- Build error
- Allow multiple address to be saved per account
- Upgrade RN version to 0.62.2
- Upgrade react-navigation to version 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magento_react_native.