当前位置 : 主页 > 网页制作 > React >

如何在react-native中向android添加resource-id

来源:互联网 收集:自由互联 发布时间:2021-06-15
我试图使用firebase TestLab,但它似乎只能以resource-id为目标.我有这样的元素: Input {...props} testID="usernameIput" / 但似乎testID未映射到resource-id.如果这不是这样做的话,那么如何在react-native中访
我试图使用firebase TestLab,但它似乎只能以resource-id为目标.我有这样的元素:

<Input {...props} testID="usernameIput" />

但似乎testID未映射到resource-id.如果这不是这样做的话,那么如何在react-native中访问resource-id?如果我不能在android studio中添加resource-id的工作是什么?

尝试构建调试.该解决方案被提议为 here

您可以使用the answer here构建调试:

#React-Native 0.49.0+
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug

#React-Native 0-0.49.0
react-native bundle --dev false --platform android --entry-file index.android.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug

然后在捆绑后构建APK:

$cd android
#Create debug build:
$./gradlew assembleDebug
#Create release build:
$./gradlew assembleRelease #Generated `apk` will be located at `android/app/build/outputs/apk`
网友评论