2014-09-07 7 views
0

Google Play 서비스에서 새 AdMob으로 전환하는 중이며 다음 오류가 표시됩니다. 그래픽 인터페이스에서. 나는 프로젝트를 여러 번 청소했지만 행운은 없다. 어떤 팁?Android/Eclipse : 다음 클래스를 인스턴스화 할 수 없습니다. - com.google.android.gms.ads.AdView

The following classes could not be instantiated: - com.google.android.gms.ads.AdView

매니페스트 :

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.ARCompware.shapetapper" 
android:versionCode="4" 
android:versionName="1.3" > 


<uses-sdk 
    android:minSdkVersion="9" 
    android:targetSdkVersion="17" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
<uses-permission android:name="android.permission.INTERNET"/> 



<application 
    android:allowBackup="true" 
    android:icon="@drawable/shapetapperlogo" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" android:logo="@drawable/shapetapperlogo"  android:requiredForAllUsers="true" 
    > 




    <activity 
     android:name="com.ARCompware.shapetapper.MainActivity" 
     android:configChanges="orientation|keyboardHidden" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" 
     android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > 

     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.ARCompware.shapetapper.HowToPlay" 
     android:label="@string/title_activity_how_to_play" 
     android:parentActivityName="com.ARCompware.shapetapper.MainActivity" 
     android:screenOrientation="portrait" > 
     <meta-data 
      android:name="android.support.PARENT_ACTIVITY" 
      android:value="com.ARCompware.shapetapper.MainActivity" /> 
    </activity> 

    <activity 
     android:name="com.ARCompware.shapetapper.GamePlay" 
     android:label="@string/title_activity_game_play" 
     android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" 
     android:screenOrientation="portrait" > 
    </activity> 

    <activity android:name="com.google.android.gms.ads.AdActivity" 
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 

    <meta-data android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version"/> 


</application> 

</manifest> 

활동 :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:ads="http://schemas.android.com/apk/res-auto" 
android:id="@+id/main" 
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=".MainActivity" > 

<Button 
    android:id="@+id/play" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_marginBottom="149dp" 
    android:background="#FF0000" 
    android:text="PLAY" 
    android:textColor="#FFF" 
    android:textSize="30dp" 
    android:textStyle="bold" 
    android:typeface="sans" 
    android:onClick="goToPlay" /> 

<Button 
    android:id="@+id/howToPlay" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignTop="@+id/play" 
    android:layout_marginTop="60dp" 
    android:background="#0000FF" 
    android:text="how to play" 
    android:textColor="#FFF" 
    android:textSize="30dp" 
    android:textStyle="bold" 
    android:typeface="sans" 
    android:onClick="htp" /> 

<Button 
    android:id="@+id/highScore" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:background="#00FF00" 
    android:text="High Score: 0" 
    android:textColor="#333" 
    android:textSize="30dp" 
    android:textStyle="bold" 
    android:typeface="sans" /> 

<ImageView 
    android:id="@+id/imgLogo" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:layout_above="@id/play" 
    android:background="@drawable/shapetapperlogo" 
    /> 

<com.google.android.gms.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_below="@id/highScore" 
         ads:adSize="BANNER" 
         ads:adUnitId="ca-app-pub-4718498587561286/4938544884" 

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

</RelativeLayout> 

Proguard와 :

-keep class * extends java.util.ListResourceBundle { 
    protected Object[][] getContents(); 
} 

# Keep SafeParcelable value, needed for reflection. This is required to support backwards 
# compatibility of some classes. 
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { 
    public static final *** NULL; 
} 

# Keep the names of classes/members we need for client functionality. 
-keepnames @com.google.android.gms.common.annotation.KeepName class * 
-keepclassmembernames class * { 
    @com.google.android.gms.common.annotation.KeepName *; 
} 

# Needed for Parcelable/SafeParcelable Creators to not get stripped 
-keepnames class * implements android.os.Parcelable { 
    public static final ** CREATOR; 
} 

답변

0

Link 당이 일 것으로 보인다으로 자바 코드가 필요합니다, 당신이 당신의에서 onCreate이를 추가해야합니다

AdView adView = (AdView)this.findViewById(R.id.adView); 
AdRequest adRequest = new AdRequest.Builder() 
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR) 
.addTestDevice("TEST_DEVICE_ID") 
.build(); 
adView.loadAd(adRequest); 

은 또한 당신의 레이아웃 같이 adView이 추가 :

<com.google.android.gms.ads.AdView 
xmlns:ads="http://schemas.android.com/apk/res-auto" 
.... 
+0

아차, 내 코드에서 자바 부분을 포함하는 것을 잊었다하지만, 네, 똑같은 것입니다. 행운을냅니다 – alexram1313

+0

Google Play 서비스 라이브러리가 애플리케이션의 동일한 작업 공간에 있는지 확인하십시오. xmlns : ads = "http://schemas.android.com/apk/res-auto" 을 태그 com에 추가하십시오. .google.android.gms.ads.AdView – user1283633

+0

시도해보십시오. 아직도 운이 없다. – alexram1313

관련 문제