Hello.
I’m on my second try of upgrading Expo/ExpoKit from SDK 30 to 34.
For both 1st and 2nd try I first follow the steps for upgrading the JS part of the project here: Expo SDK v33.0.0 is now available | by Eric Samelson | Exposition.
For the first try, of upgrading ExpoKit, I think I got a bit confused, I started from the bottom of https://docs.expo.io/versions/latest/expokit/expokit/#upgrading-expokit, and worked my way up. Now, trying to a second time from the top, doing steps under “If upgrading from SDK31 or below” seems to have already been overwritten in the above steps. What is the intended order of following these docs? Top to bottom? Bottom to top? Something in between? It seems like the “If upgrading from” should be reversed and at the top?
I can manage to get the iOS project working, but the Android project fails to initialize in Android Studio.
I get the error:
The module 'expo-gl-cpp' is an Android project without build variants, and cannot be built.
Please fix the module's configuration in the build.gradle file and sync the project again.
If I manually install it with
yarn add expo-gl-cpp
It doesn’t do anything other than changing ‘expo-gl-cpp’ to ‘android-expo-gl-cpp’ in the above error message.
If I unload the module and try to build to the emulator I get:
Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.4-all.zip'.
I’m not able to Google any of these errors in relation to Expo, so I’m guessing I messed up somewhere, but it’s difficult to determine where.
Here are my relevant files:
package.json
{
"name": "pj-nativeapp",
"version": "0.1.0",
"private": true,
"devDependencies": {
"axios-debug": "0.0.4",
"babel-plugin-module-resolver": "^3.1.1",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^3.19.0",
"eslint-config-prettier": "^4.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.10.0",
"eslint-plugin-node": "^4.2.2",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-react": "^7.0.1",
"eslint-plugin-react-native": "^3.2.1",
"eslint-plugin-standard": "^3.0.1",
"jest-expo": "33.0.0",
"plop": "^1.9.1",
"prettier": "^1.16.4",
"react-native-scripts": "1.11.1",
"react-native-unimodules": "^0.4.0",
"react-test-renderer": "16.2.0",
"remote-redux-devtools": "^0.5.12"
},
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"eject": "expo eject",
"android": "expo android",
"ios": "expo ios",
"test": "node node_modules/jest/bin/jest.js",
"remotedev": "remotedev --hostname=localhost --port=19000 --injectserver=reactnative",
"remotedev-revert": "remotedev --revert=reactnative"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"counterpart": "^0.18.5",
"events": "^2.0.0",
"exp": "^57.2.1",
"expo": "^33.0.0",
"expokit": "^33.0.4",
"fuse.js": "^3.2.1",
"moment": "^2.22.2",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-autolink": "^1.4.0",
"react-native-card-flip": "^1.0.4",
"react-native-expo-image-cache": "^3.2.0",
"react-native-fbsdk": "^0.8.0",
"react-native-gifted-chat": "^0.4.3",
"react-native-iap": "^2.3.26",
"react-native-keyboard-aware-scrollview": "^2.0.0",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-onesignal": "^3.2.12",
"react-native-sidebar": "^0.3.0",
"react-native-stopwatch-timer": "^0.0.20",
"react-native-tabs": "^1.0.9",
"react-redux": "^6.0.0",
"react-router-native": "^4.2.0",
"reactotron-react-native": "^2.2.0",
"reactotron-redux": "^2.1.3",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0",
"sentry-expo": "~1.13.0",
"throttle-debounce": "^1.0.1",
"util": "^0.10.3"
}
}
build.gradle
buildscript {
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'com.plantjammer.plantjammer'
targetSdkVersion 26
versionCode 256
versionName '2.48.2'
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Deprecated. Used by net.openid:appauth
manifestPlaceholders = [
'appAuthRedirectScheme': 'host.exp.exponent'
]
}
dexOptions {
javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
}
buildTypes {
debug {
debuggable true
ext.enableCrashlytics = false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
signingConfigs {
debug {
storeFile file('../debug.keystore')
}
}
lintOptions {
abortOnError false
}
packagingOptions {
pickFirst "**"
}
configurations.all {
resolutionStrategy.force 'com.android.support:design:28.0.0'
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
// Don't use modern jsc-android since it still has some critical bugs that
// crash applications when the string for the JS bundle is loaded and when
// locale-specific date functions are called.
// configurations.all {
// resolutionStrategy {
// force 'org.webkit:android-jsc:r216113'
// }
// }
apply from: 'expo.gradle'
apply from: "../../node_modules/react-native-unimodules/gradle.groovy"
dependencies {
compile project(':react-native-iap')
compile project(':react-native-fbsdk')
compile project(':react-native-onesignal')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.1'
// Our dependencies
implementation 'com.android.support:appcompat-v7:28.0.0'
// Our dependencies from ExpoView
// DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation('com.facebook.android:audience-network-sdk:4.99.0') {
exclude module: 'play-services-ads'
}
compileOnly 'org.glassfish:javax.annotation:3.1.1'
implementation 'com.jakewharton:butterknife:8.4.0'
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.amplitude:android-sdk:2.9.2' // Be careful when upgrading! Upgrading might break experience scoping. Check with Jesse. See Analytics.resetAmplitudeDatabaseHelper
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
annotationProcessor 'com.raizlabs.android:DBFlow-Compiler:2.2.1'
implementation "com.raizlabs.android:DBFlow-Core:2.2.1"
implementation "com.raizlabs.android:DBFlow:2.2.1"
implementation "com.madgag.spongycastle:core:1.53.0.0"
implementation "com.madgag.spongycastle:prov:1.53.0.0"
debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
implementation 'com.facebook.device.yearclass:yearclass:1.0.1'
implementation 'commons-io:commons-io:1.3.2'
implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.7'
implementation 'com.yqritc:android-scalablevideoview:1.0.1'
implementation 'commons-codec:commons-codec:1.10'
implementation 'com.segment.analytics.android:analytics:4.3.0'
implementation 'com.google.zxing:core:3.2.1'
implementation 'net.openid:appauth:0.4.1'
implementation('com.airbnb.android:lottie:2.5.5') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
implementation 'io.branch.sdk.android:library:2.17.1'
implementation('io.nlopez.smartlocation:library:3.2.11') {
transitive = false
}
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.squareup.okio:okio:1.9.0'
// Testing
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// We use a modified build of com.android.support.test:runner:1.0.1. Explanation in maven-test/README
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.robolectric:robolectric:3.8'
testImplementation 'com.android.support.test:runner:1.0.2-alpha1'
testImplementation 'com.android.support.test:rules:1.0.2-alpha1'
implementation('host.exp.exponent:expoview:33.0.0@aar') {
transitive = true
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
}
}
addUnimodulesDependencies([
modulesPaths : [
'../../node_modules'
],
configuration: 'api',
target : 'react-native',
exclude : [
// You can exclude unneeded modules here, e.g.,
// 'unimodules-face-detector-interface',
// 'expo-face-detector'
// Adding a name here will also remove the package
// from auto-generated BasePackageList.java
]
])
// This has to be down here for some reason
apply plugin: 'com.google.gms.google-services'
MainApplication.java
package host.exp.exponent;
// import org.unimodules.core.interfaces.Package;
import com.facebook.react.ReactPackage;
import java.util.Arrays;
import java.util.List;
import com.facebook.FacebookSdk;
import com.facebook.CallbackManager;
import com.facebook.appevents.AppEventsLogger;
import okhttp3.OkHttpClient;
import host.exp.exponent.generated.BasePackageList;
// Needed for `react-native link`
// import com.facebook.react.ReactApplication;
import com.dooboolab.RNIap.RNIapPackage;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
public class MainApplication extends ExpoApplication {
private static CallbackManager mCallbackManager = CallbackManager.Factory.create();
@Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}
// Needed for `react-native link`
public List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
// Add your own packages here!
// TODO: add native modules!
// Needed for `react-native link`
// new MainReactPackage(),
new RNIapPackage(),
new FBSDKPackage(mCallbackManager),
new ReactNativeOneSignalPackage()
);
}
@Override
public String gcmSenderId() {
return getString(R.string.gcm_defaultSenderId);
}
public static OkHttpClient.Builder okHttpClientBuilder(OkHttpClient.Builder builder) {
// Customize/override OkHttp client here
return builder;
}
protected static CallbackManager getCallbackManager() {
return mCallbackManager;
}
public List getExpoPackages() {
return new BasePackageList().getPackageList();
}
}
MainActivity.java
package host.exp.exponent;
import android.os.Bundle;
import android.content.Intent;
import com.facebook.react.ReactPackage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.unimodules.core.interfaces.Package;
import host.exp.exponent.generated.DetachBuildConstants;
import host.exp.exponent.experience.DetachActivity;
public class MainActivity extends DetachActivity {
@Override
public String publishedUrl() {
return "exp://exp.host/@kraegpoeth/plantjammer";
}
@Override
public String developmentUrl() {
return DetachBuildConstants.DEVELOPMENT_URL;
}
@Override
public List<ReactPackage> reactPackages() {
return ((MainApplication) getApplication()).getPackages();
}
@Override
public List<Package> expoPackages() {
// Here you can add your own packages.
return super.expoPackages();
}
@Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}
@Override
public Bundle initialProps(Bundle expBundle) {
// Add extra initialProps here
return expBundle;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
}
}
settings.gradle
include ':app'
include ':react-native-iap'
project(':react-native-iap').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-iap/android')
include ':react-native-fbsdk'
project(':react-native-fbsdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbsdk/android')
include ':react-native-onesignal'
project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android')
apply from: '../node_modules/react-native-unimodules/gradle.groovy'
// Include unimodules.
includeUnimodulesProjects()