gpt4 book ai didi

android - FaSTLane android 构建 : index. android.bundle 丢失

转载 作者:行者123 更新时间:2023-12-04 11:34:42 24 4
gpt4 key购买 nike

我正在为我们的 react 原生应用程序构建一个应用程序包 (.aab)。
当我通过 构建时安卓工作室 ,应用程序构建,部署到 Play 商店。我下载并运行 - 一切正常。
当我通过 构建时快车道 ,应用程序构建,部署到 Play 商店。 但是我下载并运行,我得到 跟随错误 :

E AndroidRuntime: java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
E AndroidRuntime: at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
E AndroidRuntime: at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:2)
E AndroidRuntime: at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:1)
E AndroidRuntime: at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:3)
W ActivityTaskManager: Force finishing activity com.friday.pax.dev/com.friday.pax.MainActivity
RN: 0.63.4
Gradle: 4.1.1
FastLane 日志:
https://gist.githubusercontent.com/HardlyMirage/4426e411b6ec1e8abac5e7a620d979ae/raw/37daead0b55ee77b7ef7d6ddd8631d311dbc80aa/txt index.android.bundle似乎已正确生成。
> Task :app:bundleDevReleaseJsAndAssets
warning: the transform cache was reset.
Welcome to React Native!
Learn once, write anywhere
info Writing bundle output to:, /home/runner/work/fridayapp-pax/fridayapp-pax/android/app/build/generated/assets/react/dev/release/index.android.bundle
info Writing sourcemap output to:, /home/runner/work/fridayapp-pax/fridayapp-pax/android/app/build/generated/sourcemaps/react/dev/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 88 asset files
info Done copying assets
Task :app:mergeDevReleaseResourcesTask :app:copyDevReleaseBundledJs 之后运行
快速文件:

def getVersionCode
# Instead of managing the version code manually it is simply based on a timestamp in sec
# Any build done more recently is considered to be a higher version
# versionCode increase every minute (aka max 1 build per minute)
# versionCode can't be smaller than legacyVersionCode
thirtySeptemberTwentyTwenty = 1601480940 / 60
legacyVersionCode = 10902
versionCode = legacyVersionCode + (Time.now.to_i / 60) - thirtySeptemberTwentyTwenty

if versionCode > 2100000000
raise "versionCode cannot be higher than 2100000000"
end

versionCode.floor()
end

platform :android do

desc "Friday (Dev)"
lane :playstoreDevInternal do |options|

# Retrieve version of my app in package.json (React Native case)
package = load_json(json_path: "../package.json")

# Clean build folder
gradle(
task: "clean"
)

# Bump android.defaultConfig.versionCode
# bump_build_number
android_set_version_code(
version_code: package["versionName"]
)

# Do the bundle of the application
gradle(
# task: "assemble",
task: 'bundle',
flavor: "dev",
build_type: "Release",
properties: {
"android.injected.signing.store.file" => Dir.pwd + "/release.keystore",
"android.injected.signing.store.password" => options[:RELEASE_KEYSTORE_PASSWORD], # keystore password
"android.injected.signing.key.alias" => options[:RELEASE_KEYSTORE_ALIAS], # alias
"android.injected.signing.key.password" => options[:RELEASE_KEYSTORE_KEY_PASSWORD], # key password
"vname" => package["version"]
}
)

# Upload Android App Bundle to PlayStore like Internal testing Release
upload_to_play_store(
package_name: 'com.friday.pax.dev',
track: 'internal',
release_status: 'draft',
skip_upload_apk: true,
version_name: package["version"]
)
end
end
谁能指出为什么 Android Studio 的 aab 包可以工作,而不是通过 FastLane 生成的包?即使 index.android.bundle 已明确生成。
我唯一的想法是 index.android.bundle 路径可能不正确。但是我看不到修改该路径的方法。

最佳答案

事实证明,gradle 脚本正在将包生成到特定于构建变体的文件夹中,但应用程序正在默认位置寻找包,而不管构建变体如何:
Gradle 脚本生成的包位置(Flavor:dev,Type:release):

android/app/build/generated/assets/react/dev/release/index.android.bundle
应用程序查看位置:
android/app/src/main/assets/index.android.bundle
所以我在 package.json 中添加了一个脚本来生成这个:
"generate:bundle": "react-native bundle --platform android --dev false --bundle-output android/app/src/main/assets/index.android.bundle --entry-file index.js"
在我的运行器脚本中运行构建命令之前,我运行脚本来生成构建:
npm run generate:build
该应用程序现在找到了 bundle 。

关于android - FaSTLane android 构建 : index. android.bundle 丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68982335/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com