android - gradlew assembleRelease 生成两个版本的APK(新旧一个)
问题描述
我通过生成 APK 文件gradlew assembleRelease
并通过adb install app-release.apk
. 问题是,当我第一次运行应用程序时一切正常,但如果我关闭应用程序(android 任务按钮 > 全部关闭)并重新运行应用程序,我会得到我的应用程序的非常旧版本(两个月前生成)。
我试过的:
cd android && ./graldew clean // before generating the APK
我也遵循以下步骤:
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) inside android/app/src/main/res
4. ./gradlew clean > ./gradlew assembleReleae
但它不起作用。这是更多信息:
//package.json
{
"name": "ktIP",
//...
},
"rnpm": {
"assets": [
"./assets/fonts"
]
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.1",
},
"devDependencies": {
"@babel/core": "^7.3.4",
"@babel/runtime": "^7.3.4",
"@types/jest": "^26.0.0",
"@types/react": "^16.9.38",
"@types/react-native": "^0.62.13",
//...
},
}
//build.gradlew
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 30
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
我可以编辑我的问题以获取更多信息。
如果我运行同样的问题,react-native run-android --variant=release
但我在调试版本中运行良好,react-native run-android
不知道是不是因为React Native(59)老版本的原因,要不要升级到63
解决方案
推荐阅读
- python - 删除熊猫数据框中不符合条件的行
- node.js - 在 AWS Lambda 函数中测试时,Mocha 框架不起作用
- java - Spring Session JDBC - 如何在会话被销毁时捕获?
- javascript - 优化表单渲染 React
- javascript - 使用 Context API 给了我未定义的
- swagger-codegen - 是否可以在 Openapi 3.0 中指定一个端点所需的参数和可选的另一个端点?
- python - 更改时间字符串的 UTC 偏移量
- java - Spring Boot 无法识别 MongoDB RestController 类
- python - 百分比分数的 Python 字母等级
- reactjs - 如何在 React js 的其他模块中为类组件使用上下文