Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
160 views
in Technique[技术] by (71.8m points)

android - Release APK Not Updating With JavaScript Code

My Android APK is running off the JavaScript present when I generated the first signed APK. I've tried cleaning/rebuilding the project in Android Studio, I've tried ./gradlew clean in the android subfolder. Any ideas as to why the code isn't updating? I've seen this issue, without any success for myself.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I deleted the index.android.* files in android/app/src/main/assets/ directory. Then in the project root, ran

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

Then I regenerated the signed APK and voila!

EDIT: If you are using a newer project, you may not have an index.android.js only index.js. If that's the case, you'll want to change it to:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...