I've just updated my android with sdk-r17 and eclipse with ADT-17. Now all my applications that use admob caused force close after building and running it either on real device or emulator (It worked well before updating)
Here is my xml layout:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.ads.AdView
android:id="#+id/admob"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="xxxxxx"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
<ListView
android:id="#+id/lv_agent"
android:layout_above="#id/admob"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:focusable="true"
android:layoutAnimation="#anim/l_slide_right"
android:listSelector="#drawable/bg_list_selector"
android:divider="#3f3f3f"
The logcat error message is:
AndroidRuntime(29533): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.londatiga.xxx/net.londatiga.xxx.xxx}: android.view.InflateException: Binary XML file line #19: Error inflating class com.google.ads.AdView
Any solutions?
This issue is a dependency jars in Android projects. The solution seems to see http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17
Related
Hi to all i'm trying to add the facebook login avaible in the facebook sdk (i'm using the 4.16.0 ver) but i got this error
android.view.InflateException: Binary XML file line #0: Binary XML
file line #0: Error inflating class
com.facebook.login.widget.LoginButton
Caused by: android.view.InflateException: Binary XML file line #0:
Error inflating class com.facebook.login.widget.LoginButton
i'm already read here but it did not work for me i post here my build.gradle file
Thank's to all!
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/layoutLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/cardview_light_background"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView4"
android:layout_width="match_parent"
android:layout_height="456dp"
android:contentDescription="imm"
android:src="#drawable/lloyd_thumbs" />
<Space
android:layout_width="match_parent"
android:layout_height="25dp" />
<Button
android:id="#+id/log_or_reg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/cardview_shadow_end_color"
android:text="Loggati e/o Registrati" />
<com.facebook.login.widget.LoginButton
android:id="#+id/login_button"
android:layout_width="344dp"
android:layout_height="54dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp" />
</LinearLayout>
edit: the problem is only when I try to inflate the activity, if I use intent I don't have any problem
This is probably because you haven't initialised the Facebook SDK.
Initiate that in the application class as below.
public class AppController extends Application {
#Override
public void onCreate() {
super.onCreate();
FacebookSdk.sdkInitialize(this);
}
}
If you have the same problem, try this.
in your buil.gradle file add this
compile 'com.android.support:multidex:1.0.0'
and add in default config this
default config{
//other stuff
multiDexEnabled true
//other stuff
}
and in yuor application add this MultiDex.install(this);
Thank's myself for answer!
I realize that there are a lot of questions with titles similar to this one, but I think my problem is one that has not yet been addressed.
I have an existing Android application that is entering the intensive beta-testing phase. To that end, I am attempting to implement Instabug to help out.
This morning, before attempting to implement Instabug, my app worked (in that it launched).
My MainActivity extends android.app.Activity, so I replaced that with InstabugActivity (com.instabug.wrapper.support.activity.InstabugActivity).
My MainActivity is for login/sign up, and then the app transitions to an AppRootActivity, which is an android.support.v7.app.ActionBarActivity. This is because the app has a navigation drawer. So, I changed AppRootActivity to an InstabugActionBarActivity (com.instabug.wrapper.support.activity.InstabugActionBarActivity).
When I run the app in debug mode using an attached device, it works just fine. When I push the app out to my testers via Fabric/Crashlytics, the app crashes at launch.
From what I can tell, these are the important error messages I'm getting:
java.lang.RuntimeException:
Unable to start activity ComponentInfo{com.company.app/com.company.app.MainActivity}:
android.view.InflateException: Binary XML file line #14:
Error inflating class fragment
Caused by:
android.view.InflateException: Binary XML file line #14:
Error inflating class fragment
at com.company.app.MainActivity.onCreate(Unknown Source)
Caused by:
android.app.Fragment$InstantiationException:
Trying to instantiate a class
com.company.app.NavigationDrawerFragment
that is not a Fragment
at com.company.app.MainActivity.onCreate(Unknown Source)
Caused by: java.lang.ClassCastException
at com.company.app.MainActivity.onCreate(Unknown Source)
Ok, now here's the weird thing. MainActivity is never tied to NavigationDrawerFragment. Never.
I have no idea why the app is trying to instantiate NavigationDrawerFragment when the app is launching.
Even still, though, NavigationDrawerFragment extends MyFragment which extends Fragment (android.support.v4.app.Fragment).
I am really, really lost here. I'd love to use Instabug, because their product on iOS is really nice and impressive, but I can't figure this out!
Edit
Here's the XML layout for ActivityMain:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#drawable/main_activity_background"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
>
<View
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
/>
<ImageView
android:gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:src="#drawable/main_activity_logo"
/>
<View
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
/>
<TextView
android:id="#+id/main_activity_tag_line_text_view"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:text="#string/tag_line"
android:textColor="#color/off_white"
android:textSize="20dp"
/>
<ImageButton
android:id="#+id/main_activity_sign_up_with_Facebook_button"
android:background="#drawable/main_activity_facebook_button_shape"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/main_activity_vertical_button_margin"
android:layout_marginTop="#dimen/main_activity_vertical_button_margin"
android:layout_width="wrap_content"
android:paddingBottom="#dimen/main_activity_facebook_sign_up_button_vertical_padding"
android:paddingLeft="#dimen/main_activity_facebook_sign_up_button_horizontal_padding"
android:paddingRight="#dimen/main_activity_facebook_sign_up_button_horizontal_padding"
android:paddingTop="#dimen/main_activity_facebook_sign_up_button_vertical_padding"
android:src="#drawable/main_activity_facebook_sign_up"
/>
<Button
android:id="#+id/main_activity_sign_up_button"
android:background="#drawable/sign_up_button_shape"
android:gravity="center"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/main_activity_vertical_button_margin"
android:layout_marginTop="#dimen/main_activity_vertical_button_margin"
android:layout_width="wrap_content"
android:text="#string/sign_up_title"
android:textColor="#color/dark_gray"
android:textSize="#dimen/login_button_text_size"
/>
<Button
android:id="#+id/main_activity_login_button"
android:background="#drawable/main_activity_login_button_shape"
android:gravity="center"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/main_activity_vertical_button_margin"
android:layout_marginTop="#dimen/main_activity_vertical_button_margin"
android:layout_width="wrap_content"
android:text="#string/login_title"
android:textColor="#color/gold"
android:textSize="#dimen/login_button_text_size"
/>
<TextView
android:id="#+id/main_activity_disclaimer_text_view"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_width="wrap_content"
android:text="#string/disclaimer"
android:textColor="#color/off_white"
android:textSize="12dp"
/>
</LinearLayout>
I've been trying to get this widget working in my Android project: https://code.google.com/p/android-coverflow/source/browse/
It's called Coverflow, and it kind of replaces the old Gallery widget. Implementing it seemed pretty straightforward until I got the error:
08-16 17:33:08.289: E/AndroidRuntime(15031): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class pl.polidea.coverflow.CoverFlow
This is the XML file the error is referring to:
<pl.polidea.coverflow.CoverFlow class="pl.polidea.coverflow.CoverFlow"
android:id="#+id/coverflow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip" >
</pl.polidea.coverflow.CoverFlow>
This question has been asked before on StackOverflow but the answer given here: Android coverflow : Error inflating class pl.polidea.coverflow.CoverFlow didn't work for me.
You should Use by this way:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<view class="pl.polidea.coverflow.CoverFlow" xmlns:coverflow="http://schemas.android.com/apk/res/pl.polidea.coverflow"
coverflow:imageWidth="100dip" coverflow:imageHeight="150dip" android:id="#+id/coverflow" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_marginTop="5dip">
</view>
<pl.polidea.coverflow.CoverFlow xmlns:coverflow="http://schemas.android.com/apk/res/pl.polidea.coverflow"
coverflow:imageWidth="100dip" coverflow:imageHeight="150dip" coverflow:withReflection="true"
coverflow:imageReflectionRatio="0.2" coverflow:reflectionGap="2dip" android:id="#+id/coverflowReflect"
android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="5dip" />
<TextView android:text="STATUS" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="5dip" android:id="#+id/statusText"></TextView>
</LinearLayout>
Make sure that "pl.polidea.coverflow.CoverFlow" is your class file(package+java class)...
Else replace "pl.polidea.coverflow.CoverFlow" in your xml with your actual class file having coverflow!!
When I am launching my application, I am getting the error:
04-29 10:20:15.655: E/AndroidRuntime(24548): android.view.InflateException: Binary XML file line #2: Error inflating class com.mobeta.android.dslv.DragSortListView
Here is my XML file:
<?xml version="1.0" encoding="utf-8"?>
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res-auto"
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="7dp"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:layout_margin="0dp"
android:dividerHeight="5dp"
dslv:drag_enabled="true"
dslv:collapsed_height="2dp"
dslv:drag_scroll_start="0.33"
dslv:max_drag_scroll_speed="0.5"
dslv:float_alpha="0.6"
dslv:slide_shuffle_speed="0.3"
dslv:track_drag_sort="false"
dslv:use_default_controller="true"
dslv:sort_enabled="false"
dslv:remove_enabled="true"
dslv:remove_mode="flingRemove"
android:background="#E5E5E5" />
Does anyone know whats causing the issue? When I attempt to specify the full url "http://schemas.android.com/apk/res/com.mobeta.android.demodslv", the project does not compile.
change xmlns:dslv="http://schemas.android.com/apk/res-auto"
to below line
xmlns:dslv="http://schemas.android.com/apk/lib/com.mobeta.android.dslv"
I'm trying to incorporate AdMob into my Android application. I'm using IntelliJ IDEA for development and I cannot seem to set my project up properly. At this point I've done the following:
Did all the preliminary steps necessary to download the AdMob SDK.
Followed the directions here, trying to augment them for IntelliJ IDEA. I've added a Single-Entry Module Library dependency to the AdMob SDK to my project.
It looks like the IDE has no problem recognizing the classes from the SDK if I try to use them in code. However, it fails to resolve them in XML. I have the following two errors:
Cannot resolve symbol 'AdActivity' when I set up the ad activity in AndroidManifest.xml the instructions call for.
Element com.google.ads.AdView is not allowed here when I try to add an ad view to a layout in the manner documented here.
Thank you very much in advance for your help. I hope I've been clear.
EDIT
A clarification based on Cristian's answer. It's true that the first error seems to not matter. However, the second error causes the project build to break with the following message:
.../res/layout/main.xml:7: error: Error parsing XML: unbound prefix
The XML in question is the following layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="123dp"
android:src="#drawable/logo"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="#drawable/cart"/>
<Button android:id="#+id/new_shopping_list"
android:layout_width="223dp"
android:layout_height="wrap_content"
android:layout_marginTop="90dp"
android:text="#string/new_shopping_list_btn"/>
<Button android:id="#+id/view_all_shopping_lists"
android:layout_width="223dp"
android:layout_height="wrap_content"
android:layout_below="#id/new_shopping_list"
android:text="#string/saved_shopping_lists_btn"/>
<ImageView android:id="#+id/copyright_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="7dp"
android:layout_marginRight="5dp"
android:src="#drawable/copyright"/>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/copyright_notice"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="4dp"
android:src="#drawable/techsmart_logo"/>
<ImageButton android:id="#+id/user_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="7dp"
android:layout_marginLeft="5dp"
android:src="#drawable/user_guide"/>
</RelativeLayout>
Do not worry about those errors. AdMob library is obfuscated, thus IntelliJ cannot read the correct names of the classes. However, your application will compile and run fine. This is how one of my projects looks like, and they work fine:
As you can see, there are other libraries like Pontiflex or AirPush that has the same problem.
With regards to your second problem, it seems you forget to add the XML NameSpace. This answer says that you must add this one:
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"