Comments (8)
Running into this same error running detox tests on Expo 31
from expo.
@douglowder I tried running the detox tests using an attached android device (instead of genymotion) and I got the same error. I am able to install and run the app on the android device using all of the adb commands that detox uses. For example all of these commands work:
adb -s G3MX81285D3081000918 shell "getprop ro.build.version.sdk"
/home/node/Android/Sdk/build-tools/34.0.0/aapt dump badging "/workspaces/my-solution/apps/my-app/android/app/build/outputs/apk/debug/app-debug.apk"
/home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 shell "pm list packages com.stewartarmbrecht.myapp.dev"
/home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 shell "pm list packages com.stewartarmbrecht.myapp.dev.test"
/home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 shell "am force-stop com.stewartarmbrecht.myapp.dev"
/home/node/Android/Sdk/build-tools/34.0.0/aapt dump xmlstrings "/workspaces/my-solution/apps/my-app/android/app/build/outputs/apk/debug/app-debug.apk" AndroidManifest.xml
/home/node/Android/Sdk/build-tools/34.0.0/aapt dump xmlstrings "/workspaces/my-solution/apps/my-app/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk" AndroidManifest.xml
/home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 shell "getprop ro.build.version.sdk"
/home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 install -r -g -t /workspaces/my-solution/apps/my-app/android/app/build/outputs/apk/debug/app-debug.apk
/home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 install -r -g -t /workspaces/my-solution/apps/my-app/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
/home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 reverse tcp:19002 tcp:19002
/home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 shell "am force-stop com.stewartarmbrecht.myapp.dev"
I think the problem is in how I am launching the app:
const appConfig = require('../../../my-app/app.config');
const { resolveConfig } = require('detox/internals');
const { device } = require('detox');
const platform = device.getPlatform();
module.exports.openApp = async function openApp() {
console.log('Opening app...', platform);
const config = await resolveConfig();
console.log('Configuration:', config.configurationName);
if (config.configurationName.split('.')[2] === 'debug') {
console.log('Opening app for debug build...');
return await openAppForDebugBuild(platform);
} else {
return await device.launchApp({
newInstance: true,
});
}
};
async function openAppForDebugBuild(platform) {
console.log('EXPO_USE_UPDATES:', process.env.EXPO_USE_UPDATES);
const deepLinkUrl = process.env.EXPO_USE_UPDATES
? // Testing latest published EAS update for the test_debug channel
getDeepLinkUrl(getLatestUpdateUrl())
: // Local testing with packager
getDeepLinkUrl(getDevLauncherPackagerUrl(platform));
if (platform === 'ios') {
await device.launchApp({
newInstance: true,
});
sleep(3000);
await device.openURL({
url: deepLinkUrl,
});
} else {
console.log('Launching app with deep link:', deepLinkUrl);
await device.launchApp({
newInstance: true,
url: deepLinkUrl,
});
}
await sleep(3000);
}
const getDeepLinkUrl = url =>
`exp+my-app://expo-development-client/?url=${encodeURIComponent(url)}`;
const getDevLauncherPackagerUrl = platform =>
`http://localhost:19002/index.bundle?platform=${platform}&dev=true&minify=false&disableOnboarding=1`;
const getLatestUpdateUrl = () =>
`https://u.expo.dev/${getAppId()}?channel-name=test_debug&disableOnboarding=1`;
const getAppId = () => appConfig?.extra?.eas?.projectId ?? '';
const sleep = t => new Promise(res => setTimeout(res, t));
I am getting the same error:
11:59:55.025 detox[3355] i device An error occurred while waiting for the app to become ready. Waiting for disconnection...
error: Failed to run application on the device
HINT: Most likely, your main activity has crashed prematurely.
Native stacktrace dump:
java.lang.Exception: IUpdatesController.launchAssetFile should not be called in dev client
at expo.modules.updates.UpdatesDevLauncherController.getLaunchAssetFile(UpdatesDevLauncherController.kt:79)
at expo.modules.updates.UpdatesPackage$createApplicationLifecycleListeners$handler$1.onCreate(UpdatesPackage.kt:103)
at expo.modules.ApplicationLifecycleDispatcher.onApplicationCreate(ApplicationLifecycleDispatcher.kt:20)
at com.stewartarmbrecht.myapp.dev.MainApplication.onCreate(MainApplication.kt:55)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
at androidx.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:483)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6910)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2219)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:8061)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
from expo.
I have noticed that I also get the same error if I have deliberately incorrect deep link for the dev client:
13:39:29.682 detox[1201] i child-process:SPAWN_END /home/node/Android/Sdk/platform-tools/adb -s G3MX81285D3081000918 shell am instrument -w -r -e detoxServer ws://localhost:40123 -e detoxSessionId e43cd9cd-af1b-0d76-a256-c4f85e4b6e1c -e detoxURLOverride 'exp+No-WORK://expo-development-client/?url=http%3A%2F%2Flocalhost%3A19002%3Fplatform%3Dandroid%26dev%3Dtrue%26minify%3Dfalse%26disableOnboarding%3D1' -e debug false com.stewartarmbrecht.myapp.dev.test/androidx.test.runner.AndroidJUnitRunner exited with code #0
13:39:29.683 detox[1201] i device An error occurred while waiting for the app to become ready. Waiting for disconnection...
error: Failed to run application on the device
HINT: Most likely, your main activity has crashed prematurely.
Native stacktrace dump:
java.lang.Exception: IUpdatesController.launchAssetFile should not be called in dev client
at expo.modules.updates.UpdatesDevLauncherController.getLaunchAssetFile(UpdatesDevLauncherController.kt:79)
at expo.modules.updates.UpdatesPackage$createApplicationLifecycleListeners$handler$1.onCreate(UpdatesPackage.kt:103)
at expo.modules.ApplicationLifecycleDispatcher.onApplicationCreate(ApplicationLifecycleDispatcher.kt:20)
at com.stewartarmbrecht.myapp.dev.MainApplication.onCreate(MainApplication.kt:55)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
at androidx.test.runner.MonitoringInstrumentation.callApplicationOnCreate(MonitoringInstrumentation.java:483)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6910)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2219)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:8061)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
13:39:29.683 detox[1201] i device The app disconnected.
13:39:29.684 detox[1201] i child-process:EXEC_CMD "/home/node/Android/Sdk/platform-tools/adb" -s G3MX81285D3081000918 reverse --remove tcp:40123
13:39:29.687 detox[1201] i child-process:EXEC_CMD "/home/node/Android/Sdk/platform-tools/adb" -s G3MX81285D3081000918 shell "screencap /sdcard/133926383_1.png"
This was the code in the openApp.js. Notice the exp+No-WORK. Maybe I just need help understanding what I should be setting this value to.
const getDeepLinkUrl = url =>
`exp+No-WORK://expo-development-client/?url=${encodeURIComponent(url)}`;
const getDevLauncherPackagerUrl = platform =>
`http://localhost:19002?platform=${platform}&dev=true&minify=false&disableOnboarding=1`;
here is my app.config
const IS_PROD = process.env.APP_VARIANT === 'prod';
const IS_PREVIEW = process.env.APP_VARIANT === 'preview';
export default {
name: IS_PROD ? 'MyApp' : (IS_PREVIEW ? 'MyApp (Preview)' : 'MyApp (Dev)'),
slug: 'my-app',
version: '0.0.7',
runtimeVersion: '0.0.7',
orientation: 'portrait',
icon: './assets/images/icon.png',
// Added for tamagui.
userInterfaceStyle: 'automatic',
splash: {
image: './assets/images/splash.png',
resizeMode: 'contain',
backgroundColor: '#ffffff',
},
owner: 'stewartarmbrecht',
scheme: IS_PROD ? 'my-app' : (IS_PREVIEW ? 'my-app-preview' : 'my-app-dev'),
updates: {
url: 'https://u.expo.dev/<REMOVED>',
},
assetBundlePatterns: ['**/*'],
ios: {
supportsTablet: true,
userInterfaceStyle: 'automatic',
bundleIdentifier: IS_PROD ? 'com.stewartarmbrecht.myapp' :
(IS_PREVIEW ? 'com.stewartarmbrecht.myapp.preview' : 'com.stewartarmbrecht.myapp.dev'),
},
android: {
userInterfaceStyle: 'automatic',
adaptiveIcon: {
foregroundImage: './assets/images/adaptive-icon.png',
backgroundColor: '#FFFFFF',
},
package: IS_PROD ? 'com.stewartarmbrecht.myapp' :
(IS_PREVIEW ? 'com.stewartarmbrecht.myapp.preview' : 'com.stewartarmbrecht.myapp.dev'),
},
web: {
favicon: './assets/images/favicon.png',
bundler: 'metro',
},
plugins: [
'expo-router',
// Added as part of tamagui.
'expo-font',
[
"expo-screen-orientation",
{
"initialOrientation": "DEFAULT"
}
],
[
'@config-plugins/detox',
{
skipProguard: false,
subdomains: ['localhost', '10.24.1.57'],
},
],
],
experiments: {
typedRoutes: true
},
extra: {
// This is the project ID from the previous step
eas: {
projectId: <REMOVED>,
},
},
};
from expo.
Also, I am able to get the app to start successfully using expo run. I have tried replicating the "Expo waiting on" address in the openApp.js file but I still get the same error.
> nx run my-app:start-detox
Packager is ready at http://localhost:19002
Starting project at /workspaces/my-solution/apps/my-app
Starting Metro Bundler
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █▄ ██ ▀▄██ ▀▀█▀ █▀█ ▄▄▄▄▄ █
█ █ █ ██▄ █▄ ██▀▀▄▄▄ █▀▀█ █ █ █
█ █▄▄▄█ ██▀█▀ ▄ ▀▄▄▀▄ ▀██ █▄▄▄█ █
█▄▄▄▄▄▄▄█ ▀▄█ ▀▄▀▄█ █▄█▄█▄█▄▄▄▄▄▄▄█
█ █▄▄▀▄██▄▀▀▀█ ▀ ▄▀ ▀▀▀▄█▄█▀▀██▄█
█▄ ▄██▄▀▀▄█ ▀▄ ▄▄ █▀▀▄▄▄▄ ▀▄▄█ █
█▄▀██ █▄█▀ ▀▀▀▀ ▄▀▀█ ██ █ ▄████ ██
█▀▄▄▀ ▄▄▀▄▀█▀▄█ ▄█ ▄█▄███▀▄ ▀▄ ▄▀█
█▄▄ █ █▄▀▄█ ▄▀ █▄█▀█▀▀▀ ▄▄▄ ▀ ▄█▀ █
█▄██ ▄▄▄▄▀▀ ▄▀ ▀ ▄▄▀▄▄██▄▄█ ▀▄▀ ▀ █
█▀ ▄ ▀▄█▄▄▄█▄▀ ▀▄█▀███▀▄▀█ ▀█▀ ▄█
█ ██ █▀▄▀▀ ▄▀█▄▄▄ ▀█▀▄ ███ ▀█ ▄█
█▄▄▄▄▄█▄▄ ▀ ▀█▀ ▄██▄▄▀▄█ ▄▄▄ █▀▀▄█
█ ▄▄▄▄▄ ██▀ ███▄▄▀█ ▄ ▄█▄ █▄█ ▀ █▀█
█ █ █ █ █▄ ▄▀▄█▀ █ ▄▄ ▄▄▄▀▀▄██
█ █▄▄▄█ █▀▀ ▄▄▀▄ █▄█ ▄█ ██▀▀▀▄▄ ▀ █
█▄▄▄▄▄▄▄█▄▄████▄▄█▄▄████▄▄▄████████
› Metro waiting on exp+my-app-dev://expo-development-client/?url=http%3A%2F%2Flocalhost%3A19002
› Scan the QR code above to open the project in a development build. Learn more: https://expo.fyi/start
› Web is waiting on http://localhost:19002
› Using development build
› Press s │ switch to Expo Go
› Press a │ open Android
› Press w │ open web
› Press j │ open debugger
› Press r │ reload app
› Press m │ toggle menu
› Press o │ open project code in your editor
› Press ? │ show all commands
Logs for your project will appear below. Press Ctrl+C to exit.
➡ [tamagui] built config and components (1104ms):
Config ./.tamagui/tamagui.config.cjs
Components ./.tamagui/tamagui-components.config.cjs
› Opening on Android...
› Opening exp+my-app-dev://expo-development-client/?url=http%3A%2F%2Flocalhost%3A19002 on MP26
› Press ? │ show all commands
Android Bundled 16341ms index.js (4786 modules)
from expo.
More detail: I am able to successfully run the detox tests in the release build: npx detox test -c android.att.release
from expo.
I've been looking at the expo updates code to figure out what might be causing the execution to end here:
UpdatesDevLauncherController.kt#L79
It's called from UpdatesPackage.kt#L103
from expo.
Running into this same error running detox tests on Expo 31
@wouterdebruijn Any luck on resolving your instance?
from expo.
If I uninstall expo-updates, I am able to run the detox tests and the error does not occur. I tried re-installing expo-updates and adding this to the debug/AndroidManifest.xml but it did not help:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:usesCleartextTraffic">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false" tools:replace="android:value"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="NEVER" tools:replace="android:value"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0" tools:replace="android:value"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="" tools:replace="android:value"/>
</application>
</manifest>
I double checked the APK to verify the values were in the app that was installed on the phone before the tests were run.
<application android:allowBackup="true" android:appComponentFactory="androidx.core.app.CoreComponentFactory" android:debuggable="true" android:extractNativeLibs="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:name="com.stewartarmbrecht.myapp.dev.MainApplication" android:networkSecurityConfig="@xml/network_security_config" android:roundIcon="@mipmap/ic_launcher_round" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="NEVER"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value=""/>
<meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/expo_runtime_version"/>
from expo.
Related Issues (20)
- [docs] Need to create channel to make update work HOT 1
- use expo-notifications for device push message HOT 2
- ReferenceError: Property 'string' doesn't exist engine: hermes HOT 1
- Deep linking through web url doesn't open my expo app in android HOT 9
- [Expo SDK 51] [Android] [expo-dev-client] - Hot reload not working HOT 4
- [expo-image-picker] HOT 1
- [docs] double scroll issue
- [expo-file-system] On Android, methods are not being executed, stuck forever (downloadAsync)
- Stuck on "Gradle build failed" for 2 years already :) HOT 2
- [expo-contacts] GetContactsAsync crash on ios HOT 1
- [expo-contacts] GetContactsAsync crash on ios HOT 4
- EXPO_USE_FAST_RESOLVER=1 ignores resolverMainFields config
- export without source maps produces significantly larger byte code HOT 3
- Expo SDK Appending Extra Headers on Network Requests to Amazon S3, Resulting in Failed Network Calls HOT 2
- onPress not called in ScrollView with contentOffset with New Architecture
- Updgrade to expo from 48 to the 51 cause an error with my image upload (Expo image picker, axios and Multer) HOT 1
- Navigating to a shared route doesn't stay within the current group HOT 1
- URL Params Not Changeable When Initial Called in Production HOT 1
- Route with Params resets to Index - Static Web & GitHub Pages HOT 5
- Packages with an "@" symbol cause errors in monorepo's.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expo.