Can't build app for android

Hi,

There’s this problem that crept up recently where the build either fails or the apk generated crashes when run on a device. I suspect it is @Scott_Harrison 's ironsource mediation plugin that is causing the issue. I received the following error message on the console -

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:App:checkReleaseAarMetadata’.

Could not resolve all files for configuration ‘:App:releaseRuntimeClasspath’.
Could not resolve com.google.firebase:firebase-messaging:[10.2.1, 17.3.99].
Required by:
project :App > com.onesignal:OneSignal:3.16.0
Failed to list versions for com.google.firebase:firebase-messaging.
Unable to load Maven meta-data from https://dl.bintray.com/ironsource-mobile/android-sdk/com/google/firebase/firebase-messaging/maven-metadata.xml.
Could not get resource ‘https://dl.bintray.com/ironsource-mobile/android-sdk/com/google/firebase/firebase-messaging/maven-metadata.xml’.
Could not GET ‘https://dl.bintray.com/ironsource-mobile/android-sdk/com/google/firebase/firebase-messaging/maven-metadata.xml’. Received status code 502 from server: Bad Gateway
Could not resolve com.google.android.gms:play-services-location:[10.2.1, 16.0.99].
Required by:
project :App > com.onesignal:OneSignal:3.16.0
Skipped due to earlier error
Failed to list versions for com.google.android.gms:play-services-location.
Unable to load Maven meta-data from https://dl.bintray.com/ironsource-mobile/android-adapters/com/google/android/gms/play-services-location/maven-metadata.xml.
Could not get resource ‘https://dl.bintray.com/ironsource-mobile/android-adapters/com/google/android/gms/play-services-location/maven-metadata.xml’.
Could not GET ‘https://dl.bintray.com/ironsource-mobile/android-adapters/com/google/android/gms/play-services-location/maven-metadata.xml’. Received status code 502 from server: Bad Gateway

As can be seen, the ironsource plugin is interfering with OneSignal so I tried removing all OneSignal related code and build again. This time the apk was generated but once installed, crashes every time it gets launched. I tried to get some information from the logs and here’s what I found -

2022-01-24 15:41:37.046 23800-23800/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.leokarun.spacegame, PID: 23800
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:7260)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6800)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6695)
    at android.app.ActivityThread.access$1300(ActivityThread.java:226)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1898)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7615)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
 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.zzbhw.attachInfo(com.google.android.gms:play-services-ads-lite@@20.3.0:20)
    at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@20.3.0:1)
    at android.app.ActivityThread.installProvider(ActivityThread.java:7255)
    	... 10 more

I hope it helps. Is anyone else facing this problem? Please help me out if you were able to find a solution/workaround.

Not sure about the first error but the second error is this:

to add a valid App ID inside the AndroidManifest

which means you need to add this to your build settings:

applicationChildElements =
{
            [[
                <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
                    android:value="ca-app-pub-yourappIdhere"/> 
            ]]
}

Yeah but I have the code added in build.settings. As said, the problem crept up fairly recently. The ads were running just fine until then.

Can you publish your build setting? What solar2d build are you using?

Currently on Solar 2d 2021.3654

Here’s my build.settings

settings =
{
plugins =
{
[“CoronaProvider.native.popup.social”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone=true, android=true }
},
[“CoronaProvider.native.popup.activity”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone=true}
},
[“plugin.notifications.v2”] =
{
publisherId = “com.coronalabs”
},
[“plugin.google.iap.billing”] =
{
publisherId = “com.coronalabs”
},
[‘plugin.vibrator’] =
{
publisherId = ‘com.fd’
},
[“plugin.googleAnalytics”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone=true, android=true }
},
[“plugin.gpgs”] = {
publisherId = “com.coronalabs”,
supportedPlatforms = {android = true}
},
[“CoronaProvider.gameNetwork.apple”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone=true }
},
[‘plugin.att’] =
{
publisherId = ‘com.solar2d’
},
[“plugin.ironSource”] =
{
publisherId=“tech.scotth”,
marketplaceId = “gjiol0”,
},
[“plugin.unityAdsIron”] = {
publisherId = “tech.scotth”,
supportedPlatforms =
{
android = { url=“https://solar2dmarketplace.com/getShared?subFolder=ironsource&sharedName=unityAds&type=Android” },
iphone = { url=“https://solar2dmarketplace.com/getShared?subFolder=ironsource&sharedName=unityAds&type=iOS” },
},
},
[“plugin.facebookIron”] = {
publisherId = “tech.scotth”,
supportedPlatforms =
{
android = { url=“http://solar2dmarketplace.com/getShared?subFolder=ironsource&sharedName=facebook&type=Android” },
iphone = { url=“http://solar2dmarketplace.com/getShared?subFolder=ironsource&sharedName=facebook&type=iOS” },
},
},
[“plugin.reviewPopUp”] =
{
publisherId=“tech.scotth”,
marketplaceId = “gjiol0”,
},
[‘plugin.facebook.v4a’] = {
publisherId = ‘com.coronalabs’
},
[“plugin.applovinIron”] = {
publisherId = “tech.scotth”,
supportedPlatforms =
{
android = { url=“https://solar2dmarketplace.com/getShared?subFolder=ironsource&sharedName=applovin&type=Android” },
iphone = { url=“https://solar2dmarketplace.com/getShared?subFolder=ironsource&sharedName=applovin&type=iOS” },
},
},
[“plugin.adColonyIron”] = {
publisherId = “tech.scotth”,
supportedPlatforms =
{
android = { url=“https://solar2dmarketplace.com/getShared?subFolder=ironsource&sharedName=adColony&type=Android” },
iphone = { url=“https://solar2dmarketplace.com/getShared?subFolder=ironsource&sharedName=adColony&type=iOS” },
},
},
[“plugin.OneSignal”] =
{
publisherId = “com.onesignal”,
},
[‘plugin.mixpanel’] =
{
publisherId = ‘com.yogergames’
},
},
splashScreen =
{
enable = false
},
orientation =
{
– Supported values for orientation:
– portrait, portraitUpsideDown, landscapeLeft, landscapeRight
default = “portrait”,
supported = { “portrait” }
},
excludeFiles =
{
– Include only the necessary files on each platform, if “Icon.png” is for iphone then exclude it from android by adding it in the android table
– excludes files from builds for a specific platforms
iphone = { “Icon-dpi.png"},
android = { “Icon.png”, "Icon-Small-
.png”, “Icon*@2x.png” },
– include only those files in this table which are to be excluded from all the platforms.
all = {“Calling points.docx”, “hostage.JPG”, “player.JPG”, “zombie.JPG”},
},

– Android Section

android =
{
usesPermissions =
{
“android.permission.INTERNET”,
“android.permission.ACCESS_NETWORK_STATE”,
“android.permission.GET_ACCOUNTS”,
“com.android.vending.BILLING”,
“android.permission.ACCESS_COARSE_LOCATION”,
“android.permission.ACCESS_WIFI_STATE”,
“com.android.vending.CHECK_LICENSE”
},
applicationChildElements =
{
– Array of strings
–this meta data is being added because for network security android now only allows secure connections(via https, called cleartext) if app is trying to connect an external server/database etc.
–We need to opt out of supporting cleartext because our backend(app42) uses http protocol. To include more domains that opt of of this service, see the network_security_config.xml file.
[[

]],
},
– facebookAppId = “593507071245316”,
googlePlayGamesAppId = “158688413349”,
useGoogleServicesJson = true,
minSdkVersion = “22”, – this version corresponds to Android 5.1
},

– iOS Section

iphone =
{
xcassets = “Images.xcassets”,
plist =
{
MinimumOSVersion= “11.0”,
UIStatusBarHidden = true,
UIRequiredDeviceCapabilities={“arm64”},
UIPrerenderedIcon = true, – set to false for “shine” overlay
UILaunchStoryboardName = “LaunchScreen”,
GADApplicationIdentifier = “ca-app-pub-5624034654834941~8142385499”, – AdMob app ID for appodeal to run
NSAppTransportSecurity = { NSAllowsArbitraryLoads=true },-- needed for appodeal
NSBluetoothAlwaysUsageDescription = “This app would like to access bluetooth.”,
NSUserTrackingUsageDescription = “This will enable us to show targeted and more relevant, higher-quality ads to you.”,
CFBundleIdentifier = “com.leokarun.spacegame”,
UIBackgroundModes = {“remote-notification”},–for onesignal push
SKAdNetworkItems = {{SKAdNetworkIdentifier = “SU67R6K2V3.skadnetwork”},{SKAdNetworkIdentifier = “ludvb6z3bs.skadnetwork”},{SKAdNetworkIdentifier =“4dzt52r2t5.skadnetwork”},{SKAdNetworkIdentifier = “v9wttpbfk9.skadnetwork”},{SKAdNetworkIdentifier = “n38lu8286q.skadnetwork”},
{SKAdNetworkIdentifier = “4pfyvq9l8r.skadnetwork”},–this line and onwards are all adColony ids
{SKAdNetworkIdentifier = “yclnxrl5pm.skadnetwork”},
{SKAdNetworkIdentifier = “v72qych5uu.skadnetwork”},
{SKAdNetworkIdentifier = “tl55sbb4fm.skadnetwork”},
{SKAdNetworkIdentifier = “t38b2kh725.skadnetwork”},
{SKAdNetworkIdentifier = “prcb7njmu6.skadnetwork”},
{SKAdNetworkIdentifier = “ppxm28t8ap.skadnetwork”},
{SKAdNetworkIdentifier = “mlmmfzh3r3.skadnetwork”},
{SKAdNetworkIdentifier = “klf5c3l5u5.skadnetwork”},
{SKAdNetworkIdentifier = “hs6bdukanm.skadnetwork”},
{SKAdNetworkIdentifier = “c6k4g5qg8m.skadnetwork”},
{SKAdNetworkIdentifier = “9t245vhmpl.skadnetwork”},
{SKAdNetworkIdentifier = “9rd848q2bz.skadnetwork”},
{SKAdNetworkIdentifier = “8s468mfl3y.skadnetwork”},
{SKAdNetworkIdentifier = “7ug5zh24hu.skadnetwork”},
{SKAdNetworkIdentifier = “4fzdc2evr5.skadnetwork”},
{SKAdNetworkIdentifier = “4468km3ulz.skadnetwork”},
{SKAdNetworkIdentifier = “3rd42ekr43.skadnetwork”},
{SKAdNetworkIdentifier = “2u9pt9hc89.skadnetwork”},
{SKAdNetworkIdentifier = “m8dbw4sv7c.skadnetwork”},
{SKAdNetworkIdentifier = “7rz58n8ntl.skadnetwork”},
{SKAdNetworkIdentifier = “ejvt5qm6ak.skadnetwork”},
{SKAdNetworkIdentifier = “5lm9lj6jb7.skadnetwork”},
{SKAdNetworkIdentifier = “44jx6755aq.skadnetwork”},
{SKAdNetworkIdentifier = “mtkv5xtk9e.skadnetwork”},
{SKAdNetworkIdentifier = “6g9af3uyq4.skadnetwork”},
{SKAdNetworkIdentifier = “275upjj5gd.skadnetwork”},
{SKAdNetworkIdentifier = “9nlqeag3gk.skadnetwork”},
{SKAdNetworkIdentifier = “cg4yq2srnc.skadnetwork”},
{SKAdNetworkIdentifier = “g28c52eehv.skadnetwork”},
{SKAdNetworkIdentifier = “rx5hdcabgc.skadnetwork”},
{SKAdNetworkIdentifier = “u679fj5vs4.skadnetwork”},
{SKAdNetworkIdentifier = “uw77j35x4d.skadnetwork”},
{SKAdNetworkIdentifier = “wg4vff78zm.skadnetwork”},
{SKAdNetworkIdentifier = “qqp299437r.skadnetwork”},
{SKAdNetworkIdentifier = “kbmxgpxpgc.skadnetwork”},
{SKAdNetworkIdentifier = “294l99pt4k.skadnetwork”},
{SKAdNetworkIdentifier = “x44k69ngh6.skadnetwork”},–unity skaids from here
{SKAdNetworkIdentifier = “mp6xlyr22a.skadnetwork”},
{SKAdNetworkIdentifier = “ppxm28t8ap.skadnetwork”},
{SKAdNetworkIdentifier = “glqzh8vgby.skadnetwork”},
{SKAdNetworkIdentifier = “k674qkevps.skadnetwork”},
{SKAdNetworkIdentifier = “w9q455wk68.skadnetwork”},
{SKAdNetworkIdentifier = “v79kvwwj4g.skadnetwork”},
{SKAdNetworkIdentifier = “3sh42y64q3.skadnetwork”},
{SKAdNetworkIdentifier = “3rd42ekr43.skadnetwork”},
{SKAdNetworkIdentifier = “238da6jt44.skadnetwork”},
{SKAdNetworkIdentifier = “9t245vhmpl.skadnetwork”},
{SKAdNetworkIdentifier = “zq492l623r.skadnetwork”},
{SKAdNetworkIdentifier = “3qy4746246.skadnetwork”},
{SKAdNetworkIdentifier = “s39g8k73mm.skadnetwork”},
{SKAdNetworkIdentifier = “5lm9lj6jb7.skadnetwork”},
{SKAdNetworkIdentifier = “mlmmfzh3r3.skadnetwork”},
{SKAdNetworkIdentifier = “5a6flpkh64.skadnetwork”},
{SKAdNetworkIdentifier = “wg4vff78zm.skadnetwork”},
{SKAdNetworkIdentifier = “lr83yxwka7.skadnetwork”},
{SKAdNetworkIdentifier = “4pfyvq9l8r.skadnetwork”},
{SKAdNetworkIdentifier = “9rd848q2bz.skadnetwork”},
{SKAdNetworkIdentifier = “32z4fx6l9h.skadnetwork”},
{SKAdNetworkIdentifier = “8s468mfl3y.skadnetwork”},
{SKAdNetworkIdentifier = “4fzdc2evr5.skadnetwork”},
{SKAdNetworkIdentifier = “yclnxrl5pm.skadnetwork”},
{SKAdNetworkIdentifier = “v72qych5uu.skadnetwork”},
{SKAdNetworkIdentifier = “f73kdq92p3.skadnetwork”},
{SKAdNetworkIdentifier = “t38b2kh725.skadnetwork”},
{SKAdNetworkIdentifier = “44jx6755aq.skadnetwork”},
{SKAdNetworkIdentifier = “2u9pt9hc89.skadnetwork”},
{SKAdNetworkIdentifier = “4dzt52r2t5.skadnetwork”},
{SKAdNetworkIdentifier = “tl55sbb4fm.skadnetwork”},
{SKAdNetworkIdentifier = “m8dbw4sv7c.skadnetwork”},
{SKAdNetworkIdentifier = “cstr6suwn9.skadnetwork”},
{SKAdNetworkIdentifier = “kbd757ywx3.skadnetwork”},
{SKAdNetworkIdentifier = “zmvfpc5aq8.skadnetwork”},
{SKAdNetworkIdentifier = “av6w8kgt66.skadnetwork”},
{SKAdNetworkIdentifier = “f7s53z58qe.skadnetwork”},
{SKAdNetworkIdentifier = “578prtvx9j.skadnetwork”},
{SKAdNetworkIdentifier = “22mmun2rn5.skadnetwork”},
{SKAdNetworkIdentifier = “488r3q3dtq.skadnetwork”},
{SKAdNetworkIdentifier = “ydx93a7ass.skadnetwork”},
{SKAdNetworkIdentifier = “4468km3ulz.skadnetwork”},
{SKAdNetworkIdentifier = “c6k4g5qg8m.skadnetwork”},
{SKAdNetworkIdentifier = “5tjdwbrq8w.skadnetwork”},
{SKAdNetworkIdentifier = “prcb7njmu6.skadnetwork”},
}
},
},
}

I don’t see your google appid for Android. Please add in the application child elements with the appropriate appId from google:

[[
                <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
                    android:value="ca-app-pub-yourappIdhere"/> 
]]

I got the same error yesterday. I do have the App ID in the build settings.
I not using any mediation or other ad plugins than admob.

The id is no longer needs to be specified for Scott’s plugin. He had addressed this in one of his updates long back and we have stopped including it ever since, and not to mention the ads were working fine.

Did you manage to solve it?

No I am afraid not. It is a new app so it was the first time testing on Android. IOS works fine.

Why don’t you try it? That error and the crash when it starts is caused by not putting the appid.

Can you share your build settings?

This should be fixed now, please try rebuilding

Just built and I am not getting the error anymore.

I am getting another error when trying to load an ad. Just saw it so not sure it is in my own code.
admob.load returns error with:

{
  "Code": 1,
  "Message": "Error building request URL.",
  "Domain": "com.google.android.gms.ads",
  "Cause": "null",
  "Response Info": {
    "Response ID": "null",
    "Mediation Adapter Class Name": "",
    "Adapter Responses": []
  }
}

Ignore last part of previous post. I was using the wrong ad unit id.
Everything seems to work now.

Yeah, the builds are working now. But the app still crashes unless I add google app ID in build.settings in spite of not using admob. I remember this problem was dealt with in the past but I’m now having to add the ID again. Is it here to stay after the latest update or will you be addressing this as well?

google app ID requirement has now been removed

1 Like