片段在较低版本的android

时间:2015-09-16 09:38:59

标签: android android-layout android-fragments android-activity android-fragmentactivity

我在我的项目中使用片段在项目的所有其他类中调用单个片段类。现在问题是我的应用程序仅在棒棒糖设备中运行并且它停在较低版本的android.I已附加以下错误消息。作为初学者,我尽我所能,但我找不到合适的解决方案。需要你的帮助朋友。建议一些可能的解决方案来解决它。

在较低版本的android

中运行时显示的错误
09-16 14:57:40.976  13600-13604/com.sentientit.theiWedplanner D/dalvikvm﹕ GC_CONCURRENT freed 354K, 28% free 6018K/8344K, paused 4ms+3ms, total 37ms
09-16 14:57:42.218  13600-13600/com.sentientit.theiWedplanner E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.ExceptionInInitializerError
            at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2135)
            at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:300)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:350)
            at android.app.Activity.setContentView(Activity.java:1930)
            at com.sentientit.theiWedplanner.Frontpage.onCreate(Frontpage.java:41)
            at android.app.Activity.performCreate(Activity.java:5283)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
            at android.app.ActivityThread.access$700(ActivityThread.java:150)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:175)
            at android.app.ActivityThread.main(ActivityThread.java:5279)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NoClassDefFoundError: android.support.v4.util.ContainerHelpers
            at android.support.v4.util.SimpleArrayMap.<init>(SimpleArrayMap.java:209)
            at android.support.v4.app.Fragment.<clinit>(Fragment.java:169)
            at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2135)
            at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:300)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:752)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:350)
            at android.app.Activity.setContentView(Activity.java:1930)
            at com.sentientit.theiWedplanner.Frontpage.onCreate(Frontpage.java:41)
            at android.app.Activity.performCreate(Activity.java:5283)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
            at android.app.ActivityThread.access$700(ActivityThread.java:150)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:175)
            at android.app.ActivityThread.main(ActivityThread.java:5279)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
            at dalvik.system.NativeStart.main(Native Method)

这是我的片段xml文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"

    android:id="@+id/adview153613"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/aagr_background2">

    <ImageView        
              android:id="@+id/addviewimage"
              android:layout_width="fill_parent"
              android:layout_height="50dp"                    
              android:src="@drawable/adview1536132" />        

      <com.google.android.gms.ads.AdView

       android:id="@+id/adView"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       ads:adSize="SMART_BANNER"
       ads:adUnitId="-----------------"
         />
       <ImageView
          android:id="@+id/addviewimage1"
          android:layout_width="@dimen/fwh"
          android:layout_height="@dimen/fwh"
          android:layout_alignParentRight="true"
          android:layout_marginRight="23dp"
          android:src="@drawable/close" />

 </RelativeLayout>

1 个答案:

答案 0 :(得分:0)

好像您已经更新了SDK工具,但没有更新SDK构建工具。尝试更新SDK Build工具,然后重新启动IDE,然后重试。