android - Exception "inflating class fragment" -


getting run time exception "inflating class fragment" when tried add google map in android application. go through previous comments similar have posted. couldn't solve it. log file attached here

08-07 05:30:41.587: e/androidruntime(2574): fatal exception: main 08-07 05:30:41.587: e/androidruntime(2574): java.lang.runtimeexception: unable start activity componentinfo{com.example.newapp/com.example.newapp.newapp}: android.view.inflateexception: binary xml file line #17: error inflating class fragment 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2211) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:2261) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.activitythread.access$600(activitythread.java:141) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.activitythread$h.handlemessage(activitythread.java:1256) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.os.handler.dispatchmessage(handler.java:99) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.os.looper.loop(looper.java:137) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.activitythread.main(activitythread.java:5103) 08-07 05:30:41.587: e/androidruntime(2574):     @ java.lang.reflect.method.invokenative(native method) 08-07 05:30:41.587: e/androidruntime(2574):     @ java.lang.reflect.method.invoke(method.java:525) 08-07 05:30:41.587: e/androidruntime(2574):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) 08-07 05:30:41.587: e/androidruntime(2574):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 08-07 05:30:41.587: e/androidruntime(2574):     @ dalvik.system.nativestart.main(native method) 08-07 05:30:41.587: e/androidruntime(2574): caused by: android.view.inflateexception: binary xml file line #17: error inflating class fragment 08-07 05:30:41.587: e/androidruntime(2574):     @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:713) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.view.layoutinflater.rinflate(layoutinflater.java:755) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.view.layoutinflater.inflate(layoutinflater.java:492) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.view.layoutinflater.inflate(layoutinflater.java:397) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.view.layoutinflater.inflate(layoutinflater.java:353) 08-07 05:30:41.587: e/androidruntime(2574):     @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:267) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.activity.setcontentview(activity.java:1895) 08-07 05:30:41.587: e/androidruntime(2574):     @ com.example.newapp.newapp.oncreate(newapp.java:12) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.activity.performcreate(activity.java:5133) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2175) 08-07 05:30:41.587: e/androidruntime(2574):     ... 11 more 08-07 05:30:41.587: e/androidruntime(2574): caused by: android.support.v4.app.fragment$instantiationexception: unable instantiate fragment com.google.android.gms.maps.supportmapfragment: make sure class name exists, public, , has empty constructor public 08-07 05:30:41.587: e/androidruntime(2574):     @ android.support.v4.app.fragment.instantiate(fragment.java:409) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.support.v4.app.fragment.instantiate(fragment.java:377) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.support.v4.app.fragmentactivity.oncreateview(fragmentactivity.java:277) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:685) 08-07 05:30:41.587: e/androidruntime(2574):     ... 21 more 08-07 05:30:41.587: e/androidruntime(2574): caused by: java.lang.classnotfoundexception: didn't find class "com.google.android.gms.maps.supportmapfragment" on path: dexpathlist[[zip file "/data/app/com.example.newapp-1.apk"],nativelibrarydirectories=[/data/app-lib/com.example.newapp-1, /vendor/lib, /system/lib]] 08-07 05:30:41.587: e/androidruntime(2574):     @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:53) 08-07 05:30:41.587: e/androidruntime(2574):     @ java.lang.classloader.loadclass(classloader.java:501) 08-07 05:30:41.587: e/androidruntime(2574):     @ java.lang.classloader.loadclass(classloader.java:461) 08-07 05:30:41.587: e/androidruntime(2574):     @ android.support.v4.app.fragment.instantiate(fragment.java:399) 08-07 05:30:41.587: e/androidruntime(2574):     ... 24 more 08-07 05:30:47.677: i/process(2574): sending signal. pid: 2574 sig: 9 08-07 05:30:53.767: d/androidruntime(2650): shutting down vm 08-07 05:30:53.767: w/dalvikvm(2650): threadid=1: thread exiting uncaught exception (group=0x414c4700) 08-07 05:30:53.857: e/androidruntime(2650): fatal exception: main 08-07 05:30:53.857: e/androidruntime(2650): java.lang.runtimeexception: unable start activity componentinfo{com.example.newapp/com.example.newapp.newapp}: android.view.inflateexception: binary xml file line #17: error inflating class fragment 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2211) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.activitythread.handlelaunchactivity(activitythread.java:2261) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.activitythread.access$600(activitythread.java:141) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.activitythread$h.handlemessage(activitythread.java:1256) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.os.handler.dispatchmessage(handler.java:99) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.os.looper.loop(looper.java:137) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.activitythread.main(activitythread.java:5103) 08-07 05:30:53.857: e/androidruntime(2650):     @ java.lang.reflect.method.invokenative(native method) 08-07 05:30:53.857: e/androidruntime(2650):     @ java.lang.reflect.method.invoke(method.java:525) 08-07 05:30:53.857: e/androidruntime(2650):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) 08-07 05:30:53.857: e/androidruntime(2650):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 08-07 05:30:53.857: e/androidruntime(2650):     @ dalvik.system.nativestart.main(native method) 08-07 05:30:53.857: e/androidruntime(2650): caused by: android.view.inflateexception: binary xml file line #17: error inflating class fragment 08-07 05:30:53.857: e/androidruntime(2650):     @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:713) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.view.layoutinflater.rinflate(layoutinflater.java:755) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.view.layoutinflater.inflate(layoutinflater.java:492) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.view.layoutinflater.inflate(layoutinflater.java:397) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.view.layoutinflater.inflate(layoutinflater.java:353) 08-07 05:30:53.857: e/androidruntime(2650):     @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:267) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.activity.setcontentview(activity.java:1895) 08-07 05:30:53.857: e/androidruntime(2650):     @ com.example.newapp.newapp.oncreate(newapp.java:12) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.activity.performcreate(activity.java:5133) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.app.activitythread.performlaunchactivity(activitythread.java:2175) 08-07 05:30:53.857: e/androidruntime(2650):     ... 11 more 08-07 05:30:53.857: e/androidruntime(2650): caused by: android.support.v4.app.fragment$instantiationexception: unable instantiate fragment com.google.android.gms.maps.supportmapfragment: make sure class name exists, public, , has empty constructor public 08-07 05:30:53.857: e/androidruntime(2650):     @ android.support.v4.app.fragment.instantiate(fragment.java:409) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.support.v4.app.fragment.instantiate(fragment.java:377) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.support.v4.app.fragmentactivity.oncreateview(fragmentactivity.java:277) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:685) 08-07 05:30:53.857: e/androidruntime(2650):     ... 21 more 08-07 05:30:53.857: e/androidruntime(2650): caused by: java.lang.classnotfoundexception: didn't find class "com.google.android.gms.maps.supportmapfragment" on path: dexpathlist[[zip file "/data/app/com.example.newapp-1.apk"],nativelibrarydirectories=[/data/app-lib/com.example.newapp-1, /vendor/lib, /system/lib]] 08-07 05:30:53.857: e/androidruntime(2650):     @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:53) 08-07 05:30:53.857: e/androidruntime(2650):     @ java.lang.classloader.loadclass(classloader.java:501) 08-07 05:30:53.857: e/androidruntime(2650):     @ java.lang.classloader.loadclass(classloader.java:461) 08-07 05:30:53.857: e/androidruntime(2650):     @ android.support.v4.app.fragment.instantiate(fragment.java:399) 08-07 05:30:53.857: e/androidruntime(2650):     ... 24 more 08-07 05:30:56.837: i/process(2650): sending signal. pid: 2650 sig: 9 

manifest.xml file

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.newapp"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk         android:minsdkversion="8"         android:targetsdkversion="18" />   <meta-data             android:name="com.google.android.maps.v2.api_key"             android:value="********************************" />        <permission         android:name="com.venky.maps.permission.maps_receive"         android:protectionlevel="signature" />          <uses-permission android:name="com.example.newapp.maps.permission.maps_receive" />         <uses-permission android:name="android.permission.internet" />         <uses-permission android:name="android.permission.write_external_storage" />         <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" />         <uses-permission android:name="android.permission.access_coarse_location" />         <uses-permission android:name="android.permission.access_fine_location" />         <uses-feature         android:glesversion="0x00020000"         android:required="true" />       <application         android:allowbackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme" >          <activity             android:name="com.example.newapp.newapp"             android:label="@string/app_name" >             <intent-filter>                 <action android:name="android.intent.action.main" />                  <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>            </application>  </manifest> 

and java file newapp.java

    import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.view.menu;  public class newapp extends fragmentactivity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_new_app);     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.new_app, menu);         return true;     }     } 

activity_new_app.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:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".newapp" >  <textview     android:id="@+id/textview1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/hello_world" />  <fragment     android:id="@+id/map"     android:name="com.google.android.gms.maps.supportmapfragment"     android:layout_width="match_parent"     android:layout_height="match_parent" /> 

please me solve problem.

one visible mistake

https://developers.google.com/maps/documentation/android/start

your meta tag must child of application tag in manifest

     <meta-data   // should inside application tag.         android:name="com.google.android.maps.v2.api_key"         android:value="********************************" /> 

change this

     <permission     android:name="com.venky.maps.permission.maps_receive"     android:protectionlevel="signature" /> 

to

    <permission     android:name="com.example.newapp.permission.maps_receive"     android:protectionlevel="signature" /> 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -