I have searched many related question, but still have no clue to solve it. Before I deleted the google_play_service_lib project, everthing is fine, BUT after i deleted it, and import it again, the error just happened...
Here are the codes:
about_frag.XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:scrollbars="vertical" >
<fragment
android:id="@+id/location_map"
android:layout_width="300dp"
android:layout_height="300dp"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
AboutFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.about_frag, container, false);
sc = (ScrollView) view.findViewById(R.id.scrollView1);
sc.setOnTouchListener(null);
TextView tv = (TextView) view.findViewById(R.id.about_text);
tv.setText(R.string.esoft_about);
MainFragmentActivity.instance().fixedTextSize(tv);
return view;
}
the Error log
12-19 15:55:09.562: E/AndroidRuntime(7013): FATAL EXCEPTION: main
12-19 15:55:09.562: E/AndroidRuntime(7013): Process: mypackage, PID: 7013
12-19 15:55:09.562: E/AndroidRuntime(7013): android.view.InflateException: Binary XML file line #48: Error inflating class fragment
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-19 15:55:09.562: E/AndroidRuntime(7013): at esoft.com.edm.AboutFragment.onCreateView(AboutFragment.java:33)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:871)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java: 431)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.view.ViewPager.populate(ViewPager.java:895)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.view.ViewPager.populate(ViewPager.java:772)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1234)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.View.measure(View.java:16497)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.View.measure(View.java:16497)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.View.measure(View.java:16497)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.View.measure(View.java:16497)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.View.measure(View.java:16497)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.View.measure(View.java:16497)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
12-19 15:55:09.562: E/AndroidRuntime(7013): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.View.measure(View.java:16497)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1916)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1113)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1295)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.Choreographer.doFrame(Choreographer.java:544)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.os.Handler.handleCallback(Handler.java:733)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.os.Handler.dispatchMessage(Handler.java:95)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.os.Looper.loop(Looper.java:136)
12-19 15:55:09.562: E/AndroidRuntime(7013): at android.app.ActivityThread.main(ActivityThread.java:5017)
12-19 15:55:09.562: E/AndroidRuntime(7013): at java.lang.reflect.Method.invokeNative(Native Method)
12-19 15:55:09.562: E/AndroidRuntime(7013): at java.lang.refle
BTW, when i delete the fragment from XML, the program work perfectly... hope is not an old question...
If you receiving the
Error inflating class fragment
error then you have some kind of problem with the way you reference the needed libraries. Take a look at this blog post i wrote and go over the first 4 section of it:Google Maps API V2
If you have committed this, and still have a problem. Try to re-download and move the
google-play-service
lib to a different location where it's path would be shorter and then reference it again.