小编cle*_*s36的帖子

React Native:使用Expo生成.apk和.ipa

我正在尝试使用Expo和Create React Native App为我的React Native应用程序生成.ipa和.apk文件.我成功构建了应用程序,并且能够让它在iOS和Android设备上运行,这要归功于以下文档:https://docs.expo.io/versions/v16.0.0/guides/building-standalone-apps. HTML

构建结束后,我的控制台会显示类似的内容

您的URL是 https://exp.host/@myname/myapp

然后exp.host/@myname/myapp我在我的设备上打开,应用程序通过Expo客户端显示.

但是在文档的第4点,据说是这样的

完成后,您将看到.apk(Android)或.ipa(iOS)文件的网址 - 这是您的应用.

我有点困惑.没有在这个过程中我看到我的电脑上任何地方生成的任何ipa或apk文件.我错过了什么吗?我如何实际生成文件?

apk ipa react-native expo create-react-native-app

17
推荐指数
4
解决办法
4万
查看次数

排毒:等待网络请求完成超时

我正在尝试设置detox以在我的应用程序上运行 e2e 测试(react native + expokit)。正如我在https://github.com/wix/Detox/issues/1627 中提到的,我的测试不断超时

Waiting for network requests to finish.: (
    "http://10.4.12.38:19001/symbolicate",
    "http://10.4.12.38:19001/symbolicate",
    "http://10.4.12.38:19001/symbolicate",
    "http://10.4.12.38:19001/symbolicate",
    "http://10.4.12.38:19001/onchange"
)
Run Code Online (Sandbox Code Playgroud)

我已经将这些网址添加到了,detoxURLBlacklistRegex但它并没有解决问题。正如我在https://github.com/wix/Detox/issues/1627 中所说的,我认为禁用实时重新加载会使测试通过,但情况并非总是如此 - 有时会,有时会超时。这是我的init.js

const detox = require('detox');
const adapter = require('detox/runners/jest/adapter');
const specReporter = require('detox/runners/jest/specReporter');

const config = require('../package.json').detox;

// Set the default timeout
jest.setTimeout(30000);
jasmine.getEnv().addReporter(adapter);

// This takes care of generating status logs on a per-spec basis. By default, jest only reports at file-level.
// This …
Run Code Online (Sandbox Code Playgroud)

testing end-to-end react-native expo detox

7
推荐指数
1
解决办法
2020
查看次数

Jest抛出TypeError:无法读取未定义的属性'fetch'

我正在尝试使用Jest在我的react/react-native库上运行一些测试(内部只有一些业务逻辑).

我们正在测试使用fetch函数的操作(使用whatwg-fetch进行polyfill).我添加了whatwg-fetch(感谢Safari)的反应.

每当我尝试运行测试时,我都会收到此错误:

TypeError: Cannot read property 'fetch' of undefined

  at node_modules/whatwg-fetch/fetch.js:4:11
  at Object.<anonymous> (node_modules/whatwg-fetch/fetch.js:461:3)
  at Object.<anonymous> (node_modules/jest-expo/src/setup.js:138:416)
Run Code Online (Sandbox Code Playgroud)

什么可能导致这个问题?在jest配置中有没有办法避免这种情况?

以下是一些用于调试的文件:

在package.json中进行Jest配置

"jest": {
"preset": "jest-expo",
"moduleFileExtensions": [
  "js",
  "jsx",
  "ts",
  "tsx"
],
"verbose": true,
"transform": {
  "^.+\\.(js|ts|tsx)$": "<rootDir>/node_modules/babel-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"testPathIgnorePatterns": [
  "\\.snap$",
  "<rootDir>/node_modules/",
  "<rootDir>/dist/"
],
"transformIgnorePatterns": [
  "node_modules/?!react-native"
]
},
Run Code Online (Sandbox Code Playgroud)

Webpack配置:

const config = {
entry: [
    'whatwg-fetch',
    __dirname + '/src/index.ts',
],
devtool: 'source-map',
output: {
    path: path.join(__dirname, '/dist'),
    filename: 'index.js',
    library: 'checkinatwork-module',
    libraryTarget: 'umd',
    umdNamedDefine: true,
}, …
Run Code Online (Sandbox Code Playgroud)

fetch reactjs webpack jestjs react-native

5
推荐指数
1
解决办法
3628
查看次数

Android 上的排毒构建失败:dexing 时出错

我无法通过detox build一个全新的 Expokit 项目。构建在这些任务上失败:

> Transform full.jar (project :unimodules-core) with DexingTransform
AGPBI: {"kind":"error","text":"Default interface methods are only supported starting with Android N (--min-api 24): java.util.List org.unimodules.core.interfaces.Package.createExportedModules(android.content.Context)","sources":[{}],"tool":"D8"}

> Task :expo-font:mergeLibDexDebugAndroidTest FAILED
AGPBI: {"kind":"error","text":"Default interface methods are only supported starting with Android N (--min-api 24): java.util.List org.unimodules.core.interfaces.Package.createExportedModules(android.content.Context)","sources":[{}],"tool":"D8"}

> Task :expo-linear-gradient:mergeLibDexDebugAndroidTest FAILED
AGPBI: {"kind":"error","text":"Default interface methods are only supported starting with Android N (--min-api 24): java.util.List org.unimodules.core.interfaces.Package.createExportedModules(android.content.Context)","sources":[{}],"tool":"D8"}

> Task :expo-app-loader-provider:mergeLibDexDebugAndroidTest FAILED
AGPBI: {"kind":"error","text":"Default interface methods are only supported starting with Android …
Run Code Online (Sandbox Code Playgroud)

android react-native expo detox

5
推荐指数
1
解决办法
1924
查看次数