2013-07-29 90 views
0

我已經能夠讓我的xml佈局中的代碼出現廣告,但有1個問題。代碼確實按預期構建和執行,但在xml編輯器中,佈局被以下錯誤阻止:亞馬遜廣告xml渲染問題

呈現問題以下類無法實例化: - com.amazon.device.ads.AdLayout(Open類,顯示異常) 提示:在您的自定義視圖中使用View.isInEditMode()可以在IDE中顯示時跳過代碼或顯示示例數據異常詳細信息java.lang.NullPointerException在android.os.Environment.getExternalStorageState at com.amazon。 device.ads.DebugProperties.readDebugProperties(DebugProperties.java:75)at com.amazon.device.ads.InternalAdRegistration。(InternalAdRegistration.java:52)at com.amazon.device.ads.InternalAdRegistration。(InternalAdRegistration.java:48)在com.amazon.device.ads.AdLayou的com.amazon.device.ads.AdLayout.initialize(AdLayout.java:186) t.initialize(AdLayout.java:177)在 ...

這是我的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="@drawable/background5" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:id="@+id/MainLayout" 
tools:context=".MainActivity"> 


//start button 
<Button 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Start" 
     android:background="#19d2b2" 
     android:id="@+id/start_button" 
     android:layout_above="@+id/instructions_button5" 
     android:layout_centerHorizontal="true"/> 

//Instructions button 
<Button 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Instructions" 
     android:background="#19d2b2" 
     android:id="@+id/instructions_button6" 

     android:layout_below="@+id/start_button" 
     android:layout_alignLeft="@+id/start_button" 
     android:layout_marginTop="10dp"/> 

<Button 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Gallery" 
     android:background="#19d2b2" 
     android:id="@+id/save_button" 
     android:layout_below="@+id/instructions_button6" 
     android:layout_alignParentRight="true" 
     android:layout_marginTop="10dp"/> 

<Button 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Scores" 
     android:id="@+id/Scores" 
     android:background="#19d2b2" 
     android:layout_below="@+id/save_button" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="10dp"/> 

<com.amazon.device.ads.AdLayout 
     android:id="@+id/adview" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="500dp"/> 

任何人或知道是否有針對此問題的修復有任何更多的信息關於什麼可能導致這個?

+0

也許你會給一些代碼... – TN888

+0

抱歉 – ez4nick

回答

0

同樣的事情發生在我身上。 xml設計編輯器應該向您展示您的佈局將如何顯示。嘗試模擬您的應用或將其連接到實際設備。它應該仍然有效。但是,對於具有廣告視圖的佈局,您總是會遇到渲染問題。