built android package failed to launch

Bad Bad Bad news! :sob:
App still failed to lunch upon install. Just opens then closes back immediately. Don’t know what’s wrong this time.
App works fine when i was developing and was running via expo go app. (Local server)
I also publish to a default channel via expo and and it worked fine when accessed.

Could the issue be associated with the apk version?
If I happen to build for aab (playstore) does it mean thesame error will occur?

connect your device to your computer. run adb logcat (or use https://webadb.com/ if you don’t have android sdk installed, and go to logcat). find the error that is crashing the app

1 Like

so i used log cat (from android studio) to try find the error and this is what I got

2022-08-13 04:11:22.782 21494-21494/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: ng.howtech.twengar, PID: 21494
    java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException: 
    
    ******************************************************************************
    * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
    * should follow the instructions here:                                       *
    * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
    * to add a valid App ID inside the AndroidManifest.                          *
    * Google Ad Manager publishers should follow instructions here:              *
    * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
    ******************************************************************************
    
    
        at android.app.ActivityThread.installProvider(ActivityThread.java:7588)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:7119)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7036)
        at android.app.ActivityThread.access$1600(ActivityThread.java:257)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2038)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:268)
        at android.app.ActivityThread.main(ActivityThread.java:8017)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
     Caused by: java.lang.IllegalStateException: 
    
    ******************************************************************************
    * The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
    * should follow the instructions here:                                       *
    * https://googlemobileadssdk.page.link/admob-android-update-manifest         *
    * to add a valid App ID inside the AndroidManifest.                          *
    * Google Ad Manager publishers should follow instructions here:              *
    * https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
    ******************************************************************************
    
    
        at com.google.android.gms.internal.ads.zzbht.attachInfo(com.google.android.gms:play-services-ads-lite@@20.5.0:20)
        at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@20.5.0:1)
        at android.app.ActivityThread.installProvider(ActivityThread.java:7583)
        	... 10 more

reading the above error, not sure I understand the context but looks its mentioning a problem with admob, if I delete the admobconfig.js file could that possibly fix the error?

i’m not sure what “admobconfig.js” is but a good start is to remove that and any admob libraries from your project and build again

I will try that.
let me add that I saw a documentation to run the app via npx expo start --no-dev --minify ; as this mimics production mode in local server. I did that and It returns a “uncaught error: java.lan.exception:failed to load all assests” I reloaded like 4 times and app opens fine after that. And does not bring the error again when I rebundle app.

So I have removed the admobconfig.js file, but when I run using npx expo start --no-dev --minify it returns the error Unable to resolve module ../app/services/adMobConfig from C:\Users\User\Desktop\My Website\twengar\My APP\twengar\screens\ListingDetailScreen.jsx:
the admobconfig.js file is disabled anyway, so I dont think it is the problem. (I haven’t configured the app to show admob ads yet)

I think the fix here will be to find that thing expo go does differential in production compared to when built to standalone.
my point is if the command npx expo start --no-dev --minify is supposed to run local server as if in production mode and it works fine. (let me mention that it returns a uncaught error: java.lan.exception:failed to load all assests each time i stop server and start again-- done that twice now) then why not run correctly when built? Definitely has to be something expo does differently in local server and built mode.
@notbrent I see the “expo team” badge on your chat, I believe you would know more or have access to info, please help here, my project is stalling and it’s heartbreaking :pray:

@wodin @notbrent
Y’all don’t give up on me just yet please? :sob::pray:t3:

as the troubleshooting doc explained there are quite a few differences between expo go and a production build. this is one of the reasons why we would encourage moving to expo-dev-client for serious apps.

even if you aren’t actually using admob in your code, just the presence of the package could cause this error. as for the “unable to resolve module” error - i assume you can fix that based on the error message.

I have not used AdMob before, but it looks to me like your ListingDetailScreen.jsx imports ../app/services/adMobConfig

One thing to be careful about:
If you.reference a file in your code as adMobConfig, then the actual file on disk, and in Git must have the same case of letters. AdMobConfig.js or admobconfig.js or ADMOBconfig.js etc., etc., will cause problems.

I doubt that’s the problem here, but you did use different cases when talking about the file compared to the error message, so I thought I would just mention it in case.

Hi everyone, thanks soo much for your time, the app is running fine now.
The issue was indeed with admob, (as logcat had dictated). Instead of leaving the admob configurations inside the app without using it, I instead implemented it completely and imported the required components and set the app up with an admob test key, as though i intend on showing ads. I built the app again, and this time it installs fine and opens correctly on my android device.

I’m getting the previous warnings from expo doctor again, the ones initially solve by @wodin, and I don’t know how those warnings affect my app in general, but so far the apk works fine and without errors.

1 Like

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