This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
My application was running fine but then I got the error and tried to re run the API, clean the build but nothing worked. When lookied into the logcat error found two errors with which I could find a solution for. The following are the errors.
11-08 21:50:09.981: ERROR/AndroidRuntime(352): Caused by: java.lang.ClassNotFoundException: android.view.Relativelayout in loader dalvik.system.PathClassLoader[/data/app/com.examples-1.apk]
11-08 21:50:09.981: ERROR/AndroidRuntime(352): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class Relativelayout
The following is the contents of my class:
public class Vathiyar extends Activity{
private Button findvathiyar;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.vathiyar);
}
}
Following is my xml code..
<?xml version="1.0" encoding="utf-8"?>
<Relativelayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/vathiyar_1"
android:orientation = "vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="#+id/widget32"
android:layout_width="wrap_content"
android:layout_height="-11px"
android:text="Welcome to the Selection of Vathiyar page"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
>
</TextView>
</Relativelayout>
Your problem is in your XML. You have RelativeLayout spelled incorrectly.
Change:
<Relativelayout ...
</Relativelayout>
To:
<RelativeLayout ...
</RelativeLayout>
Related
Below is my XML code:
<com.github.pedrovgs.DraggableView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:draggable_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/draggable_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
draggable_view:enable_minimized_horizontal_alpha_effect="true"
draggable_view:top_view_height="200dp"
draggable_view:top_view_id="#+id/image"
draggable_view:bottom_view_id="#+id/ll"
draggable_view:top_view_margin_bottom="50dp"
draggable_view:top_view_margin_right="10dp"
draggable_view:top_view_resize="true"
draggable_view:top_view_x_scale_factor="2.3"
draggable_view:top_view_y_scale_factor="2.3">
<ImageView
android:id="#+id/image"
android:background="#drawable/imgone"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.github.pedrovgs.DraggableView>
I supposed to have dragabble view in my app.while running my app the following error throws:
Caused by: android.view.InflateException: Binary XML file line #8: For input string: "200.0dip"
Caused by: java.lang.NumberFormatException: For input string: "200.0dip"
There's a bug in that random github library you're using. It doesn't see 200dp as a number, presumably because its not expecting dp there. You're going to have to fix it yourself or contact the author and see if he's willing to do so. Or not use dp, and code around the scaling issues somehow.
i'm new to android studio and my app is crushing besuase line of code
songProgressBar.setOnSeekBarChangeListener(this);
posting a question here helped me to realize it is a typo with an id in my layout. Well, here is the code for my layout with songProgressBar as an id.
<SeekBar
android:id="#+id/songProgressBar"
android:layout_width="fill_parent"
android:layout_height="25dp"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:layout_above="#id/player_footer_bg"
android:thumb="#drawable/seek_handler"
android:progressDrawable="#drawable/seekbar_progress_blue"
android:paddingLeft="6dp"
android:paddingRight="6dp"/>
Now, i don't know what the typo is, and i don't know what i'm to do. the person who told me it is a typo said i should check whether the component is present in the layout when the activity is running. I've got no idea what I'm to do now. pls help.
There seems to be a null pointer exception.
21:39:10.999 1443-1443/? E/AndroidRuntime: Caused by: java.lang.NullPointerException 01-10 21:39:10.999 1443-1443/? E/AndroidRuntime: at com.example.passion.patrimusic.MainActivity.onCreate(MainActivity.java:86) 01-10 21:39:10.999
And from your above comment, its possible that songProgressBar is null.
If you are getting it from the layout, check if there's any typo in the Id and whether the component is present in the layout when the activity is running.
I'm trying to implement flowtextview into bauerca / drag-sort-listview but I'm getting an error inflating a row. Could you help me?
Error line is in (ResourceDragSortCursorAdapter.java (Bauerca)):
#Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return mInflater.inflate(mLayout, parent, false);
}
Eclipse says:
Ecipse says "FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #8: Error inflataing class com.pagesuite.flowtext.FlowTextView"
The row layout is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="67dp"
android:orientation="horizontal">
<com.pagesuite.flowtext.FlowTextView
android:id="#+id/nuevo_ingr_row_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#id/drag_handle"
android:layout_width="wrap_content"
android:layout_height="67dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="10dip"
android:background="#drawable/ic_move" />
<ImageView
android:id="#id/click_remove"
android:layout_width="67dp"
android:layout_height="67dp"
android:layout_alignParentRight="true"
android:layout_marginTop="400dip"
android:padding="10dip"
android:background="#drawable/ic_close" />
</com.pagesuite.flowtext.FlowTextView>
</LinearLayout>
It probably fails to find your com.pagesuite.flowtext.FlowTextView class.
First check if this class is actually in that package? Did you use a library or copy this class into your own project? If you copied it, you'll need to change the package to the correct value aka point it to your own class.
You got that error just because your xml layout file is not recognise the package com.pagesuite.flowtext.FlowTextView
If you change it to right one then error will not be there.
Feel free to comments.
I wrote the FlowTextView class. The project has had quite a few bug fixes and the JAR file hasn't been updated so I would advise against using the JAR file and check the whole source out and use it as a library project.
This means you get the latest version and it will probbly solve your import issue at the same time.
IF you are not familiar with library projects in eclipse then check this
I have an app made with monodroid, it's on release stage (ready to get released) but I would like to have a free ad-supported version of my app. I've been searching the web for a tutorial of Admob 6.1.0 implementation on monodroid without any luck. I'd have to mention that I've never worked with ads before.
I was wondering if anyone has been able to use Admob 6.1.0 on monodroid and if you could share your knowledge
I've seen this source code and also this tutorial, but I just can't manage to understand correctly how to implement it. I't would be nice if someone could make an answer as a community wiki so it can help others to get introduced to Admob in monodroid
EDIT:
Tried Greg Shackles sample step by step, i'm now getting this error android.view.InflateException: Binary XML file line #1: Error inflating class com.google.ads.AdView. Any sugestion of how to make it work?
EDIT 2:
Changed the XML file and now getting 2 new errors: Java.Lang.NoClassDefFoundError and System.TypeInitializationException. XML looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/Background2"
>
<com.google.ads.AdView android:id="#+id/ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="AD_UNIT_ID_GOES_HERE"
ads:testDevices="TEST_EMULATOR,TEST_DEVICE_ID_GOES_HERE"
ads:loadAdOnCreate="true"/>
</RelativeLayout>
And adview is called like this:
public class MyActivity : Activity
{
private View _adView;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.AboutActivityLayout);
AdMobHelper.RegisterEmulatorAsTestDevice();
_adView = FindViewById(Resource.Id.Ad);
AdMobHelper.RequestFreshAd(_adView);
loadData();
}
}
The first error you got "android.view.InflateException: Binary XML file line #1: Error inflating class com.google.ads.AdView" is related to the Jar Build Action setting.
You should check two things first:
the jar file has the Build Action property set to "AndroidJavaLibrary"
the java file called "AdMobHelper.java" should have the Build Action property set to "AndroidJavaSource"
It seems to me that the error you are getting now is related to the java file not being correctly configured as an AndroidJavaSource.
I am having an issue with using TabHost in a new Intent of type TabActivity which I hope you can point me in the right direction. Funnily it works fine when I try to view it in the original Intent : setContentView(R.layout.main)
I get a "forced closed" and within logcat, I get the following error even though my Tabhost id = "#android:id/tabhost":
02-18 22:23:11.937:
ERROR/AndroidRuntime(5944): Caused by:
java.lang.RuntimeException: Your
content must have a TabHost whose id
attribute is 'android.R.id.tabhost'
I have declared the second intent in the Manifest.xml file:
XML:
<activity android:name=".NextActivity" android:label="#string/app_name" >
Within the first activity (MainActivity), I start the second intent (NextActivity), with extras, as follows:
Intent nextActivity = new Intent(MainActivity.this,NextActivity.class);
Bundle b_next=new Bundle();
b_next.putString("s_string", myString);
nextActivity.putExtras(b_next);
In my NextActivity.java file, I get the extras and try to display the TabHost View:
public class NextActivity extends TabActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String myString;
Bundle b_initial;
b_initial = getIntent().getExtras();
myString = b_initial.getString("s_string");
setContentView(R.layout.main);
}
}
I get the same error with using the TabHost example on the Android Developer site (Hellow View):
Main.xml:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a tab" />
<TextView
android:id="#+id/textview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is another tab" />
<TextView
android:id="#+id/textview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a third tab" />
</FrameLayout>
</LinearLayout>
</TabHost>
Thanks in advance folks...
CLARIFICATION:
This is what I really get from LogCat:
java.lang.NullPointerException
at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java 285)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java 640)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java 640)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java 640)
at android.view.ViewRoot.handleMessage(ViewRoot.java 1645)
at android.os.Handler.dispatchMessage(Handler.java 99)
at android.os.Looper.loop(Looper.java 123)
at android.app.ActivityThread.main(ActivityThread.java 3948)
at java.lang.reflect.Method.invokeNative(Native
Method)
at java.lang.reflect.Method.invoke(Method.java 521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java 782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java 540)
at dalvik.system.NativeStart.main(Native
Method)
I had the same problem. Luckily there was a quick fix:
Delete the R file.
Wait for your IDE to generate the file.
Profit!
I had copied and pasted code and noticed that in the id attribute I had:
android:id="#+id/tabs"
when what I really wanted was:
android:id="#android:id/tabs"
I have previously constructed tabhosts with an id of android:id="#+id/tabhost". Does this work for you?
You could also consider constructing your tab view programmatically:
TabHost t = getTabHost();
TabSpec tab = t.newTabSpec(label)
.setIndicator(label, icon)
.setContent(intent);
t.addTab(tab);
I also encountered this problem. I had an XML file that wasn't linked against my code properly in my res/layout. When I fixed the naming, the problem went away.
even though i had changed my main.xml to use android:id="#android:id/tabhost" like the error stated, it kept trying to use the old name. finally i found the file res/layout-port/main.xml that was identical to main.xml except used the wrong android:id. i must have added a portrait view accidentally and it was holding on to the old value. either fixing the portrait file or removing it fixes my problem.
I also had this error. For me it would appear after obfuscation(via ProGuard), pre obfuscation it was fine.
In the end I renamed my layout file to something more complex and unique, and ProGuard didn't mess up the linking. Bit easer than going down the ProGuard configeration path.
So my issue was similar to SapphireSun, though expressed via a different process(and post eclipse, just to make things that bit more difficult).
This is perhaps one of the more obscure ways to get this error, but I thought it worth a mention.
"public class NextActivity extends TabActivity" --change TabActivity to ActivityGroup.
when problem happen when you want wo run tabhost in tabhost.it is ok.
I am experiencing the same error in a team-project, when using SVN. Sometimes, eclipse uploads classes.dex and resources.ap_ from the bin folder of the project and others get it via SVN update.
Since these binary files are generated on the individual machines with individual code, thats probably where the error comes from.
Cleaning the project files (Project -> Clean) always solved the issue for us!
I had this issue along with 'ERROR: Unknown option '--no-crunch''. If you updated ADT plug-in in Eclipse but have not updated the SDK at the same time. Updating the SDK Manager in Eclipse, fixed the issue for me.