【发布时间】:2019-04-29 18:32:41
【问题描述】:
将 expo 版本更新到 31.0.0 后,我无法再运行我的应用程序。由于 iOS 版本 12 支持,我需要此升级。你尝试构建 Android 应用程序后它不再工作。
我的 package.json 如下所示:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.13.1",
"jest-expo": "^31.0.0",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"axios": "^0.18.0",
"expo": "^31.0.4",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz",
"react-native-image-slider": "^2.0.3",
"react-native-onesignal": "^3.1.4",
"react-native-progress": "^3.4.0",
"react-native-render-html": "^3.9.3",
"react-navigation": "^1.5.11"
}
}
app.json 看起来像:
{
"expo": {
"sdkVersion": "31.0.0",
"name": "myapp",
"slug": "myapp",
"version": "0.1.1",
"isDetached": true,
"detach": {
"scheme": "expe6b74e69f7904f4b8961fc359e0dc1ce",
"androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.4.0-sdk26.0.0-e63d9209-070c-4118-b06b-c60e82da0b66.tar.gz"
},
"android": {
"package": "com.myapp"
}
}
}
Android build.gradle 应用如下所示:
android {
compileSdkVersion 27
buildToolsVersion '26.0.1'
defaultConfig {
applicationId 'com.ferrometal12'
targetSdkVersion 27
versionCode 1
versionName '0.1.1'
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Deprecated. Used by net.openid:appauth
manifestPlaceholders = [
'appAuthRedirectScheme': 'host.exp.exponent'
]
}
知道为什么这不再适用于 Android 了吗?
注意:在我有 expo 26.0.0 之前,我也有 targetSdkVersion 到 26,在更新 expo 之后我也更新了 targetSdkVersion 到 27
更新:这个错误发生在模拟器上,我还没有在真实设备上尝试过,但我感觉在真实设备上也会出现同样的情况。
【问题讨论】:
-
我也有同样的问题。你找到解决方法了吗?
-
我看到你在package.json和app.json中有不同的sdk版本
-
我还没有找到任何解决方案,你呢?
-
@Mizlul 刚刚添加了一个答案。
-
@Mizlul 我只是更新了 app.json 的 sdk :) 现在它可以工作了
标签: android android-studio react-native-android expo android-studio-3.0