[Issue] detached SDK 27.0.0 don't run on Android development mode

When i run the project on Android Studio do test with XDE, this happens:

I try it on my project

{
  "expo": {
    "sdkVersion": "27.0.0",
    "name": "Ecocard",
    "description": "Seja digital! Troque cartões de visitas com o Ecocard!",
    "slug": "ecocard",
    "icon": "./assets/img/icon-android.png",
    "privacy": "unlisted",
    "version": "2.1.8-internal",
    "platforms": [
      "ios",
      "android"
    ],
    "assetBundlePatterns": [
      "**/*"
    ],
    "updates": {
      "enabled": false
    },
    "splash": {
      "backgroundColor": "#adc200"
    },
    "scheme": "ecocard",
    "orientation": "portrait",
    "facebookAppId": "__MYKEY__",
    "facebookDisplayName": "Ecocard",
    "facebookScheme": "__MYKEY__",
    "android": {
      "versionCode": 9,
      "package": "br.com.i9xp.ecocard",
      "icon": "./assets/img/icon-android.png",
      "permissions": [
        "READ_CONTACTS",
        "READ_PROFILE",
        "WRITE_CONTACTS",
        "LOCATION",
        "ACCESS_FINE_LOCATION",
        "ACCESS_COARSE_LOCATION",
        "CAMERA",
        "READ_INTERNAL_STORAGE",
        "READ_EXTERNAL_STORAGE",
        "WRITE_EXTERNAL_STORAGE"
      ],
      "config": {
        "googleSignIn": {
          "certificateHash": "__MYKEY__"
        }
      },
      "publishBundlePath": "android/app/src/main/assets/shell-app.bundle",
      "publishManifestPath": "android/app/src/main/assets/shell-app-manifest.json"
    },
    "ios": {
      "buildNumber": "0.0.5",
      "icon": "./assets/img/icon-ios.png",
      "bundleIdentifier": "br.com.i9xp.ecocard",
      "supportsTablet": false,
      "config": {
        "googleSignIn": {
          "reservedClientId": "__MYKEY__"
        }
      },
      "infoPlist": {
        "NSContactsUsageDescription": "Allow Ecocard to access and update your contacts with data from cards",
        "NSLocationWhenInUseUsageDescription": "Allow Ecocard to use your location to look around your area and list nearby cards",
        "NSPhotoLibraryUsageDescription": "Give Ecocard permission to access your photos to update your data across Ecocard's server"
      },
      "publishBundlePath": "ios/ecocard/Supporting/shell-app.bundle",
      "publishManifestPath": "ios/ecocard/Supporting/shell-app-manifest.json"
    },
    "locales": {
      "pt": "./assets/locales/pt.json"
    },
    "isDetached": true,
    "detach": {
      "androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.5.0-sdk27.0.0-52e1bcea-f10c-4bf8-bfd7-d1630727dec0.tar.gz",
      "iosExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/ios-v2.5.4-sdk27.0.0-e68cfb94-9b7e-4510-aab9-8f375e187b0b.tar.gz"
    }
  }
}

I try it on a new project too

{
  "expo": {
    "name": "my-new-project",
    "description": "This project is really great.",
    "slug": "my-new-project",
    "privacy": "unlisted",
    "sdkVersion": "27.0.0",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "enabled": false
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    },
    "isDetached": true,
    "detach": {
      "androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.5.1-sdk27.0.0-bb187a9e-e43b-409f-8a5e-c16afa958cca.tar.gz"
    },
    "scheme": "exp69e0bbba510042cda06a7215ff32c53f",
    "android": {
      "package": "br.com.i9xp.ecocard",
      "publishBundlePath": "android/app/src/main/assets/shell-app.bundle",
      "publishManifestPath": "android/app/src/main/assets/shell-app-manifest.json"
    }
  }
}

i try everthing, and this error still there.
This error not happens on a signed production apk.
I need SDK 27 to bundling my assets for a non internet application.

Hi @victorwads - thanks very much for letting us know about this! This is a bug which will be fixed in the next minor release of SDK 27 (coming soon). In the meantime, you can work around it by temporarily setting ARE_REMOTE_UPDATES_ENABLED = true in your android/app/src/main/java/host/exp/exponent/generated/AppConstants.java file when doing local development. (You’ll just need to remember to set it back to false before building a production apk).

Really sorry for the inconvenience! Let me know if you have any other issues related to this.

2 Likes

Thank You. It worked for me!

1 Like

@esamelson Since you mentioned that this would be fixed in the next minor release, does that mean that this is fixed in SDK 27.0.2? Thanks!

Hi @pcowgill - actually no, this is a native-side fix, so you’ll just need to follow the normal expokit upgrade guide to get the latest version of expokit 27 that we put out last week.

1 Like

Thanks for the info! I’ve followed that upgrade guide, and I’ve also added
public static final boolean ARE_REMOTE_UPDATES_ENABLED = true;
under
public class AppConstants {
in android/app/src/main/java/host/exp/exponent/generated/AppConstants.java
but unfortunately I’m still getting the same error shown in @victorwads’s screenshot. I’ll report back here if I find a solution.

@pcowgill - are you running your app in XDE or with exp start at the time you make the build?

I’m using XDE

@esamelson FYI I’ve been able to get the same issue with exp start also.

Hi, @pcowgill

After u modify android/app/src/main/java/host/exp/exponent/generated/AppConstants.java u need to rebuild your apk.

Can u send all code from android/app/src/main/java/host/exp/exponent/generated/AppConstants.java?

Thanks for the info. I’m attempting to run it locally in the Genymotion emulator, so I’ve been rebuilding in Android Studio frequently. Here are the contents of android/app/src/main/java/host/exp/exponent/generated/AppConstants.java:

package host.exp.exponent.generated;

import com.facebook.common.internal.DoNotStrip;

import java.util.ArrayList;
import java.util.List;

import host.exp.exponent.BuildConfig;
import host.exp.exponent.Constants;

@DoNotStrip
public class AppConstants {

public static final String VERSION_NAME = “2.3.0”;
public static String INITIAL_URL = “exp://exp.host/[redacted]/[redacted]”;
public static final boolean IS_DETACHED = true;
// TODO: Make sure to remove this next line before building for production
public static final boolean ARE_REMOTE_UPDATES_ENABLED = true;
public static final String SHELL_APP_SCHEME = “exp84e7af6bc7924bcaa278041b7c10a5e1”;
public static final String RELEASE_CHANNEL = “default”;
public static boolean SHOW_LOADING_VIEW_IN_SHELL_APP = false;
public static final List<Constants.EmbeddedResponse> EMBEDDED_RESPONSES;

static {
List<Constants.EmbeddedResponse> embeddedResponses = new ArrayList<>();

// ADD EMBEDDED RESPONSES HERE
// START EMBEDDED RESPONSES
// END EMBEDDED RESPONSES
EMBEDDED_RESPONSES = embeddedResponses;

}

// Called from expoview/Constants
public static Constants.ExpoViewAppConstants get() {
Constants.ExpoViewAppConstants constants = new Constants.ExpoViewAppConstants();
constants.VERSION_NAME = VERSION_NAME;
constants.INITIAL_URL = INITIAL_URL;
constants.IS_DETACHED = IS_DETACHED;
constants.SHELL_APP_SCHEME = SHELL_APP_SCHEME;
constants.RELEASE_CHANNEL = RELEASE_CHANNEL;
constants.SHOW_LOADING_VIEW_IN_SHELL_APP = SHOW_LOADING_VIEW_IN_SHELL_APP;
constants.EMBEDDED_RESPONSES = EMBEDDED_RESPONSES;
constants.ANDROID_VERSION_CODE = BuildConfig.VERSION_CODE;
return constants;
}
}

try change this value to true

@pcowgill and I are working together on a detached app and noticed the same issue. We resolved the issue after a series of steps, so we are not sure exactly which one addressed it, but we completed the following:

  1. Use Gradle 3.1.2
  2. Added jcenter() as a repo under gradle dependencies (this might have also fixed some Kotlin build issues with Android Studio)
  3. Upgraded to latest versions of my native dependencies, namely react-native-network-info.

This was a strange problem without much in the way of debugging aid, so I hope these steps can be of help to anyone else.

Should I still try this, in light of the comments by @loganwedwards above? Or is the value of true good as long as the bug is gone? What effect does that variable have? Thanks!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.