Adding an AdView broke my working app

77 views
Skip to first unread message

Daniel Anturaju

unread,
Jan 6, 2019, 1:33:57 PM1/6/19
to Google Mobile Ads SDK Developers
Hi.
I have created an Android App that was working fine on my phone and on virtual device. I decided to add an AdView so I can display ads. Big mistake! My app stopped working and I'm unable to get the app working again even if I removed all the AdView related code.
I created 2 more apps containing only one AdView. Adding that AdView to the apps makes the apps crash and don't open on my phone or virtual device. I have fallowed the instruction sent by email step by step and modified all the necessary files on my app,  but the app does not work anymore after AdView is added. Any help ? 
Here are some logs:
2019-01-06 20:28:59.041 8164-8177/? E/memtrack: Couldn't load memtrack module
2019-01-06 20:29:08.313 1692-1757/? E/storaged: getDiskStats failed with result NOT_SUPPORTED and size 0
2019-01-06 20:29:26.888 1684-1696/? E/installd: Failed to delete /data/app/vmdl1817358704.tmp: No such file or directory
2019-01-06 20:29:29.109 15556-15556/eu.birsan.adsensedoi E/AndroidRuntime: FATAL EXCEPTION: main
    Process: eu.birsan.adsensedoi, PID: 15556
    java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.birsan.adsensedoi/eu.birsan.adsensedoi.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
        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.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
        at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:555)
        at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at eu.birsan.adsensedoi.MainActivity.onCreate(MainActivity.java:16)
        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) 
2019-01-06 20:29:56.613 1784-1784/? E/netmgr: Failed to open QEMU pipe 'qemud:network': Invalid argument
2019-01-06 20:29:56.614 1784-1784/? E/netmgr: WifiForwarder unable to open QEMU pipe: Invalid argument



and error log from my app that used to work before adding AdView and even if I removed the AdView and related code, my app does not work anymore and I have to start again.

2019-01-06 20:30:55.681 15788-15788/eu.birsan.calculatorcarburantro E/AndroidRuntime: FATAL EXCEPTION: main
    Process: eu.birsan.calculatorcarburantro, PID: 15788
    java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.birsan.calculatorcarburantro/eu.birsan.calculatorcarburantro.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
        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.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
        at android.support.v7.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:555)
        at android.support.v7.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:518)
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:466)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at eu.birsan.calculatorcarburantro.MainActivity.onCreate(MainActivity.java:53)
        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) 



HaRd'k GoSai

unread,
Jan 6, 2019, 1:58:57 PM1/6/19
to Google Mobile Ads SDK Developers
Prob is in your style see logcat error: You need to use a Theme.AppCompat theme

Daniel Anturaju

unread,
Jan 6, 2019, 2:34:16 PM1/6/19
to Google Mobile Ads SDK Developers
Okay, but how can I do that. I have searched online but the solutions I have found don't work.

mobileadssdk-a...@google.com

unread,
Jan 7, 2019, 2:53:00 AM1/7/19
to Daniel Anturaju, Google Mobile Ads SDK Developers
Hi Daniel,

Thank you for reaching out to us.

Based from the error logs captured, it seems that your MainActivity is extending an Activity subclass (e.g. AppCompatActivity) that requires the AppCompat theme to be applied.

However, this seems to be more of a general Android implementation concern rather than anything specific to the Mobile Ads SDK. It's best that you raise this over to the Android developer forums or refer to this Android Style and Theme guide.

Regards,
Ivan Bautista
Mobile Ads SDK Team




--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/69094089-4c32-454e-9de0-7009c052c361%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Anturaju

unread,
Jan 7, 2019, 6:07:00 AM1/7/19
to Google Mobile Ads SDK Developers
Hi and thanks a lot for your replay. I get this error only after I added an AdView and followed the instructions sent by email by AdMob. I created two more apps that contain only one element: one AdView and after I add the adview the app stop working even if I modified my files as instructed by email. I did not add any styles or anything , but I can't use AdMob because when I add an AdView on any app the app will stop working. 

mobileadssdk-a...@google.com

unread,
Jan 8, 2019, 1:44:59 AM1/8/19
to Daniel Anturaju, Google Mobile Ads SDK Developers
Hi Daniel,

Can you share with us the copy of your project so we can further investigate? You may share it privately using Reply privately to author option.

Regards,
Ivan Bautista
Mobile Ads SDK Team


On 01/07/19 19:07:00 dan...@birsan.eu wrote:
Hi and thanks a lot for your replay. I get this error only after I added an AdView and followed the instructions sent by email by AdMob. I created two more apps that contain only one element: one AdView and after I add the adview the app stop working even if I modified my files as instructed by email. I did not add any styles or anything , but I can't use AdMob because when I add an AdView on any app the app will stop working. 

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

I.D.E.

unread,
Jan 8, 2019, 8:48:07 AM1/8/19
to Google Mobile Ads SDK Developers
If you're using Interstitial ads (full screen ads), add this to your AndroidManifest.xml

<activity
      android:name="com.google.android.gms.ads.AdActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
      android:theme="@android:style/Theme.Translucent" />

Unfortunately, it's not mentioned on the documentation pages, so use the Github sample code.

Daniel Anturaju

unread,
Jan 8, 2019, 9:33:54 AM1/8/19
to Google Mobile Ads SDK Developers
I managed to solve the problem. I created a new app using API 21 instead of API15 that I was using before and the app was working after adding the adview and all code modifications. Second, I have recreated my original app (it was only a simple app) using API21 then added the adview and everything is working fine, now my app is on Play Store with ads. It seems that API15 is not supported .... ?

mobileadssdk-a...@google.com

unread,
Jan 9, 2019, 12:41:44 AM1/9/19
to Daniel Anturaju, Google Mobile Ads SDK Developers
Hi Daniel,

I'm happy to hear that it is now working correctly on your end. Please note that as per guide, the Mobile Ads SDK targets Android API level 14 or higher.

Also, you are not required to explicitly declare any Mobile Ads SDK specific activities in your manifest file to be able to load any of the AdMob Ad formats.

Regards,
Ivan Bautista
Mobile Ads SDK Team




On 01/08/19 22:33:54 dan...@birsan.eu wrote:
I managed to solve the problem. I created a new app using API 21 instead of API15 that I was using before and the app was working after adding the adview and all code modifications. Second, I have recreated my original app (it was only a simple app) using API21 then added the adview and everything is working fine, now my app is on Play Store with ads. It seems that API15 is not supported .... ?

marți, 8 ianuarie 2019, 08:44:59 UTC+2, mobileadssdk-a...@google.com a scris:
Hi Daniel,

Can you share with us the copy of your project so we can further investigate? You may share it privately using Reply privately to author option.

Regards,
Ivan Bautista
Mobile Ads SDK Team



On 01/07/19 19:07:00 dan...@birsan.eu wrote:
Hi and thanks a lot for your replay. I get this error only after I added an AdView and followed the instructions sent by email by AdMob. I created two more apps that contain only one element: one AdView and after I add the adview the app stop working even if I modified my files as instructed by email. I did not add any styles or anything , but I can't use AdMob because when I add an AdView on any app the app will stop working. 

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsubscrib...@googlegroups.com.

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages