This question already has answers here:
Android app fail to start after adding admob
(4 answers)
Closed 9 years ago.
I'm trying to add AdMob ads to my app but when I do it, as soon as I launch my app it crashes.
This is my XML code:
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="mydevid"
ads:adSize="BANNER"
ads:testDevices="mydeviceid"
ads:loadAdOnCreate="true"/>
Also, once I get it to work, how do I set where exactly is the ad going to be shown? Thank you
Logcat file:
06-13 23:41:03.576: E/AndroidRuntime(17419): FATAL EXCEPTION: main
06-13 23:41:03.576: E/AndroidRuntime(17419): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.matthewstudios.gw2legendary/com.example.gw2legendary.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class com.google.ads.AdView
I don't want to leave the question unanswered so I'll just link to the awesome answer that helped me solve the problem!
Follow these stepes and adMob will work 100%!
Related
I have tried implementing the banner ad code following the correct documentation as seen here. Now when I run the app both on my Virtual Device and Mobile phone crashes after showing the splash screen.
My error is pointing to:
setContentView(R.layout.activity_main);
I have also implemented MaxAdViewAdListener in my MainActivity.java
On my activity_main design below is how I have added the banner ad code as below:
<com.applovin.mediation.ads.MaxAdView
android:layout_width="match_parent"
android:layout_height="#dimen/banner_height"
android:background="#color/banner_background_color"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
maxads:adUnitId="e96696c22#####" />
The Ad although displays in the Design section on Android studio. Below are the exceptions displayed in the Run section:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.packagename.eaxample/com.packagename.eaxample.MainActivity}: android.view.InflateException: Binary XML file line #371 in com.packagename.eaxample:layout/activity_main: Binary XML file line #371 in com.packagename.eaxample:layout/activity_main: Error inflating class com.applovin.mediation.ads.MaxAdView
Caused by: android.view.InflateException: Binary XML file line #371 in com.packagename.example:layout/activity_main: Binary XML file line #371 in com.packagename.example/activity_main: Error inflating class com.applovin.mediation.ads.MaxAdView
Caused by: android.view.InflateException: Binary XML file line #371 in com.packagename.example:layout/activity_main: Error inflating class com.applovin.mediation.ads.MaxAdView
With this Error inflating class com.applovin.mediation.ads.MaxAdView, you have to check the following:
Check if your com.applovin.mediation.ads.MaxAdView in XML file can be referenced. If not, you may have to confirm if you have imported the correct libraries.
It uses an additional namespace: maxads:adUnitId. Check if the corresponding link for this namespace is correctly set: xmlns:maxads="http://schemas.applovin.com/android/1.0"
I have a bug problem where my app closes whenever it launches and I have read that I should look in my logcat to identify problem but I don't know how do I read the logcat and understand how to solve the problems. These are all the errors I'm getting in my logcat
FATAL EXCEPTION: main
Process: com.mydomain.calculator, PID: 6294
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mydomain.calculator/com.mydomain.calculator.MainActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
This is the only androidruntime error I'm getting. I'm not sure how to solve it can someone help
I think your theme already has a toolbar and in your layout you are trying to use another one. So, remove the default toolbar that comes within your theme. In your themes.xml, change parent to NoActionBar like below.
<style name="<app theme name>" parent="Theme.MaterialComponents.DayNight.NoActionBar">
This question already has answers here:
CorruptedCacheException: Corrupted IndexBlock 298298 found in cache '/Users/macuser/.gradle/caches/journal-1/file-access.bin'
(11 answers)
Closed 1 year ago.
I have been executing my app in Android Studio, but the task is failed with an error message 'Caused by: org.gradle.cache.internal.btree.CorruptedCacheException: Corrupted DataBlock 1277548 found in cache 'C:\Users\pc.gradle\caches\journal-1\file-access.bin'.'
Please someone help me out
you can delete the file-access.bin in path C:\Users.gradle\caches\journal-1. After deleting it, I restarted Android Studio and rebuilt the project.
I am trying to change the font of a TextView programatically in android studio, ive followed some tutorials closely but it keeps giving me errors and was just wondering if anyone has any ideas?
Examples of questions I followed:
Android develop LCD font
How to change the font on the TextView?
TextView:
TextView
android:id="#+id/settingsTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Settings"
android:layout_marginLeft="60dp"/>
Code that changes font:
Typeface myTypeface = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/Stocky.ttf");
TextView settingsTitle = (TextView) findViewById(R.id.settingsTitle);
settingsTitle.setTypeface(myTypeface);
Error log:
Function: selinux_android_load_priority [0], There is no sepolicy file
Function: selinux_android_load_priority [1], There is no sepolicy version file
Function: selinux_android_load_priority , loading version is VE=SEPF_GT-I9507_4.3_0016
selinux_android_seapp_context_reload: seapp_contexts file is loaded from /seapp_contexts
It wasn't working because I was doing the code part in the onCreate, even though i was actually using fragments, so I just deleted the fragment and went back to using the normal activity and its working now.
thanks for the help.
I build the project successfully but when I run the project on emulator I get this error on screen.
Unfortunately Linphone has stop working!
While the logcat displays the runtime errors
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo
{org.linphone/org.linphone.LinphoneActivity}:
android.view.InflateException: Binary XML file line #60:
Error inflating class org.linphone.ui.Numpad at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
Please do help me solve this out. I will totally appreciate!