Reputation: 2290
I am making an app using react native detached, I was able to successfully build my app and generated apk release for android, the problem is after that I added few more features, some more code I am not able to see these features on my phone it takes the old .apk.
Question: What do I need to do in order so I get a new release .apk with the latest changes. Do I have to do anything from react prespective or just from Android Studio?
I have tried to clean, rebuild and generate new signed apk, but I am still unable to see the new changes on the app on phone, looks like Android Studio is not generating a new apk with latest changes, it somehow generates the old one cached or idk.
Anyone can help on this?
Upvotes: 2
Views: 6506
Reputation: 576
Generating Release Apk Steps:
1.Delete (index.android.bundle) files inside directory android/app/src/main/assets.
2.run $ 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
3.Delete folders (drawable,drawable-hdpi,drawable-mdpi,drawable-xhdpi,drawable-xxhdpi,drawable-xxxhdpi,raw)
4.run $ react-native run-android --variant=release
Upvotes: 5
Reputation: 123
Updating index.android.bundle solved my issue.
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
I was also struggling with this issue and after searching over the internet and applying many solutions, this helps me link.
Upvotes: 0
Reputation: 5143
What worked for me was the following:
cd android
gradlew clean
gradlew assembleRelease
Upvotes: 1
Reputation: 2290
For everyone that needs to know this: in fact when you make changes to react native app, you have to publish through expo kit to build bundle.js and publisht it, so apk will have the latest bundle changes of your app. Basically you only need to build new apk from Android Studio only when you change native features, like if you using some native features for push notification or smth which makes changes on the java code!
Upvotes: 0
Reputation: 349
Are you sure that the new application is different from the previous ? Please compare the size of the first APK you created with the second APK (the one with the changes)
If the size is not the same then suppress cache file of your applciation on your phone and reinstall it
If it is the same size then try :
android.enableBuildCache=true
to your gradle.propertiesor
Run > Edit Configuration
.
Under Before launchAdd
add Gradle-aware Make
and leaving Task empty.Upvotes: 0