App crashes at launch

Hello guys! I’m having some problem!

I’ve detached my app from expo, and it worked. Now, I executed “exp publish” command, and it worked, I’ve my app in my profile.

Now, when I go to debug with Android studio the application with a device emulator, the app crashes at launch.

This is the stacktrace:

E/AppLoader: Error fetching cached manifest, falling back to default timeout: Could not load manifest. Are you sure this experience has been published?
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.pollMe.pollMeApp, PID: 13971
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pollMe.pollMeApp/host.exp.exponent.MainActivity}: java.lang.IllegalArgumentException: unexpected url: http:
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.IllegalArgumentException: unexpected url: http:
        at expolib_v1.okhttp3.Request$Builder.url(Request.java:142)
        at host.exp.exponent.kernel.ExponentUrls.addExponentHeadersToUrl(ExponentUrls.java:45)
        at host.exp.exponent.kernel.ExponentUrls.addExponentHeadersToManifestUrl(ExponentUrls.java:57)
        at host.exp.exponent.ExponentManifest.fetchManifest(ExponentManifest.java:212)
        at host.exp.exponent.ExponentManifest.fetchManifest(ExponentManifest.java:196)
        at host.exp.exponent.AppLoader.fetchRemoteManifest(AppLoader.java:193)
        at host.exp.exponent.AppLoader.startTimerAndFetchRemoteManifest(AppLoader.java:189)
        at host.exp.exponent.AppLoader.startTimerAndFetchRemoteManifest(AppLoader.java:183)
        at host.exp.exponent.AppLoader.access$800(AppLoader.java:20)
        at host.exp.exponent.AppLoader$3.onError(AppLoader.java:160)
        at host.exp.exponent.ExponentManifest.fetchCachedManifest(ExponentManifest.java:266)
        at host.exp.exponent.AppLoader.start(AppLoader.java:91)
        at host.exp.exponent.experience.ExperienceActivity.onCreate(ExperienceActivity.java:242)
        at host.exp.exponent.experience.DetachActivity.onCreate(DetachActivity.java:35)
        at android.app.Activity.performCreate(Activity.java:7009)
        at android.app.Activity.performCreate(Activity.java:7000)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
D/Exponent: Loaded exp.host status page.

I’m getting stuck :frowning: Has anyone had this problem? If yes, how did you solve it?

Thank you guys!

Hey @th3edo,

exp has long since been replaced by the expo-cli. Can you install it, run expo publish and see if that helps?

Cheers,
Adam

1 Like

Hello @adamjnav

I am experiencing the same problem after using expo-cli. I am using these instructions https://docs.expo.io/versions/latest/expokit/eject/

  1. Start the app with expo start, this start the development server that serves the javascript.
  2. Attempt to build and run the app from Android Studio

NOTE: I use the tunnel to connect to the development server

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.kubano, PID: 24348
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kubano/host.exp.exponent.MainActivity}: java.lang.IllegalArgumentException: Invalid URL host: ""
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3303)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
        at android.app.ActivityThread.-wrap12(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
        at android.os.Handler.dispatchMessage(Handler.java:108)
        at android.os.Looper.loop(Looper.java:166)
        at android.app.ActivityThread.main(ActivityThread.java:7529)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
     Caused by: java.lang.IllegalArgumentException: Invalid URL host: ""
        at okhttp3.HttpUrl$Builder.parse(HttpUrl.java:1405)
        at okhttp3.HttpUrl.get(HttpUrl.java:916)
        at okhttp3.Request$Builder.url(Request.java:165)
        at host.exp.exponent.kernel.ExponentUrls.addExponentHeadersToUrl(ExponentUrls.java:45)
        at host.exp.exponent.kernel.ExponentUrls.addExponentHeadersToManifestUrl(ExponentUrls.java:57)
        at host.exp.exponent.ExponentManifest.fetchManifest(ExponentManifest.java:212)
        at host.exp.exponent.ExponentManifest.fetchManifest(ExponentManifest.java:196)
        at host.exp.exponent.AppLoader.fetchRemoteManifest(AppLoader.java:186)
        at host.exp.exponent.AppLoader.startTimerAndFetchRemoteManifest(AppLoader.java:182)
        at host.exp.exponent.AppLoader.startTimerAndFetchRemoteManifest(AppLoader.java:176)
        at host.exp.exponent.AppLoader.access$800(AppLoader.java:20)
        at host.exp.exponent.AppLoader$3.onError(AppLoader.java:153)
        at host.exp.exponent.ExponentManifest.fetchCachedManifest(ExponentManifest.java:266)
        at host.exp.exponent.AppLoader.start(AppLoader.java:91)
        at host.exp.exponent.experience.ExperienceActivity.onCreate(ExperienceActivity.java:241)
        at host.exp.exponent.experience.DetachActivity.onCreate(DetachActivity.java:35)
        at android.app.Activity.performCreate(Activity.java:7383)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3256)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411) 
        at android.app.ActivityThread.-wrap12(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994) 
        at android.os.Handler.dispatchMessage(Handler.java:108) 
        at android.os.Looper.loop(Looper.java:166) 
        at android.app.ActivityThread.main(ActivityThread.java:7529) 

Holy S***

This has to be the 5th or 6th un-documented shot in the dark code change i’ve made that’s miraculously fixed everything. This project really needs to add integration test coverage for crazy things like building / running.

FIX:
In your main activity you will notice a DetachBuildConstants.DEVELOPMENT_URL is a static final “”. Obviously this is wrong (or was autogenerated incorrectly) . You need to change this to the URL that your development server is running on. You will find this on the webpage that starts when you run expo start or yarn start

import android.os.Bundle;

import com.facebook.react.ReactPackage;

import org.unimodules.core.interfaces.Package;

import java.util.List;

import host.exp.exponent.experience.DetachActivity;
import host.exp.exponent.generated.DetachBuildConstants;

public class MainActivity extends DetachActivity {

  @Override
  public String publishedUrl() {
    return "exp://exp.host/@juicypasta/Kubano";
  }

  @Override
  public String developmentUrl() {
    return DetachBuildConstants.DEVELOPMENT_URL;
  }

  @Override
  public List<ReactPackage> reactPackages() {
    return ((MainApplication) getApplication()).getPackages();
  }

  @Override
  public List<Package> expoPackages() {
    return ((MainApplication) getApplication()).getExpoPackages();
  }

  @Override
  public boolean isDebug() {
    return BuildConfig.DEBUG;
  }

  @Override
  public Bundle initialProps(Bundle expBundle) {
    // Add extra initialProps here
    return expBundle;
  }
}
2 Likes

th3edo
would you have found the solution for this problem?
thanks

@juicypasta Thank you so much, you have fixed my problem. I tried reinstalling clean projects probably 5 times and everytime my app would crash on start.

I have added the native react URL that is displayed in the console after executing expo start (ip = your IP4 adress):

Your native app is running at myapp://ip:19000

Before inserting the ip:

public static final String DEVELOPMENT_URL = “”;

After inserting:

public static final String DEVELOPMENT_URL = “myapp://ip:19000”;

Steps to reproduce:
SDK version 36

  1. expo init
  2. expo eject
  3. expo start (keep running)
  4. open android folder in Android studio (Android pie + build tools intalled)
  5. run build, no errors
  6. on the emulator the app crashes instantly on start. Stacktrace:

E/AppLoader: Error fetching cached manifest, falling back to default timeout: Could not load manifest. Are you sure this experience has been published?
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.florianwolf.voicekeep, PID: 15657
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.florianwolf.voicekeep/host.exp.exponent.MainActivity}: java.lang.IllegalArgumentException: Invalid URL host: “”
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalArgumentException: Invalid URL host: “”
at okhttp3.HttpUrl$Builder.parse(HttpUrl.java:1405)
at okhttp3.HttpUrl.get(HttpUrl.java:916)
at okhttp3.Request$Builder.url(Request.java:165)
at host.exp.exponent.kernel.ExponentUrls.addExponentHeadersToUrl(ExponentUrls.java:45)
at host.exp.exponent.kernel.ExponentUrls.addExponentHeadersToManifestUrl(ExponentUrls.java:57)
at host.exp.exponent.ExponentManifest.fetchManifest(ExponentManifest.java:220)
at host.exp.exponent.ExponentManifest.fetchManifest(ExponentManifest.java:204)
at host.exp.exponent.AppLoader.fetchRemoteManifest(AppLoader.java:186)
at host.exp.exponent.AppLoader.startTimerAndFetchRemoteManifest(AppLoader.java:182)
at host.exp.exponent.AppLoader.startTimerAndFetchRemoteManifest(AppLoader.java:176)
at host.exp.exponent.AppLoader.access$800(AppLoader.java:20)
at host.exp.exponent.AppLoader$3.onError(AppLoader.java:153)
at host.exp.exponent.ExponentManifest.fetchCachedManifest(ExponentManifest.java:274)
at host.exp.exponent.AppLoader.start(AppLoader.java:91)
at host.exp.exponent.experience.ExperienceActivity.onCreate(ExperienceActivity.java:242)
at host.exp.exponent.experience.DetachActivity.onCreate(DetachActivity.java:35)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
I/Process: Sending signal. PID: 15657 SIG: 9
Process 15657 terminated.