coo*_*Dog 29 javascript android node.js react-native expo
更新 expo 后,它不再支持使用expo build:android -t apk构建 apk 文件,而是建议使用命令eas build -p android --profile Preview使用 eas 构建,但最终构建的是 aab 而不是 apk。我查看了新添加的 eas.json 文件,其中包含:
{
"cli": {
"version": ">= 0.52.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}
Run Code Online (Sandbox Code Playgroud)
我阅读了 eas 文档,它建议将我的 eas.json 更改为:
{
"cli": {
"version": ">= 0.52.0"
},
"build": {
"preview": {
"android": {
"buildType": "apk"
}
},
"preview2": {
"android": {
"gradleCommand": ":app:assembleRelease"
}
},
"preview3": {
"developmentClient": true
},
"production": {}
}
}
Run Code Online (Sandbox Code Playgroud)
运行构建命令后:eas build -p android --profile Preview
它正确地将应用程序构建为 apk 文件,并在 Android 上安装得很好,但打开时它会立即自行关闭。尝试重新打开后,它再次关闭,现在警告应用程序崩溃。
我的 eas.json 文件是否有错误或者我错过了什么?
小智 27
将生产密钥更改eas.json
为此
"production": {
"android": {
"buildType": "apk"
}
}
Run Code Online (Sandbox Code Playgroud)
所以现在你eas.json
就像这样
{
"cli": {
"version": ">= 0.52.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}
}
}
Run Code Online (Sandbox Code Playgroud)
要构建到.apk文件中,您可以使用生产配置文件进行构建。命令是这样的
eas build --profile production --platform android
小智 21
这是详细说明: https://docs.expo.dev/build/eas-json/
您需要eas.json在项目目录中创建如下:
{
"build": {
"preview": {
"android": {
"buildType": "apk"
}
},
"production": {}
},
"cli": {
"version": ">= 0.52.0"
}
}
Run Code Online (Sandbox Code Playgroud)
然后使用以下命令:
eas build -p android --profile preview
Run Code Online (Sandbox Code Playgroud)
问候,沙米尔
| 归档时间: |
|
| 查看次数: |
46955 次 |
| 最近记录: |