加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 09:30:50 所属栏目:百科 来源:网络整理
导读:我试图使用firebase TestLab,但它似乎只能以resource-id为目标.我有这样的元素: Input {...props} testID="usernameIput" / 但似乎testID未映射到resource-id.如果这不是这样做的话,那么如何在react-native中访问resource-id?如果我不能在android studio中
我试图使用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`

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读